Class: Sukima::Constraints::Length
- Inherits:
-
Object
- Object
- Sukima::Constraints::Length
- Defined in:
- lib/sukima/constraints.rb
Instance Method Summary collapse
Instance Method Details
#call(args, value) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/sukima/constraints.rb', line 37 def call(args, value) case args when Integer "should have length of #{args}" unless value.respond_to?(:length) && value.length == args when Range "should have length in #{args}" unless value.respond_to?(:length) && args.include?(value.length) end end |