Skip to content
Define types with optional constraints
Ruby
Find file
Latest commit 31ff2c7 Feb 26, 2015 @gix gix Fix Float type minimum constraint
Float::MIN denotes the smallest *positive* value. Since Floats have a sign
bit -Float::MAX is the true minimum.

README.md

axiom-types

Define types with optional constraints for use within axiom and other libraries.

Gem Version Build Status Dependency Status Code Climate Coverage Status

Examples

# 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 for details.

Copyright

Copyright © 2013 Dan Kubb. See LICENSE for details.

Something went wrong with that request. Please try again.