1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
# axiom-types
Define types with optional constraints for use within axiom and other libraries.
[][gem]
[][travis]
[][gemnasium]
[][codeclimate]
[][coveralls]
[gem]: https://rubygems.org/gems/axiom-types
[travis]: https://travis-ci.org/dkubb/axiom-types
[gemnasium]: https://gemnasium.com/dkubb/axiom-types
[codeclimate]: https://codeclimate.com/github/dkubb/axiom-types
[coveralls]: https://coveralls.io/r/dkubb/axiom-types
## Examples
```ruby
# Setup constraints for all defined types
Axiom::Types.finalize
# Create Name subtype
Name = Axiom::Types::String.new do
minimum_length 1
maximum_length 30
end
# Test if the string is a member of the type
Name.include?('a') # => true
Name.include?('a' * 30) # => true
Name.include?('') # => false
Name.include?('a' * 31) # => false
```
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
## Copyright
Copyright © 2013 Dan Kubb. See LICENSE for details.
|