Class: Jschematic::Attributes::MinLength
- Inherits:
-
Object
- Object
- Jschematic::Attributes::MinLength
- Includes:
- Element
- Defined in:
- lib/jschematic/attributes/max_length.rb
Instance Attribute Summary
Attributes included from Element
Instance Method Summary collapse
- #accepts?(instance) ⇒ Boolean
-
#initialize(length) ⇒ MinLength
constructor
A new instance of MinLength.
Methods included from Element
#required?, #schema_for, #title, #to_s
Constructor Details
#initialize(length) ⇒ MinLength
Returns a new instance of MinLength.
8 9 10 |
# File 'lib/jschematic/attributes/max_length.rb', line 8 def initialize(length) @length = length end |
Instance Method Details
#accepts?(instance) ⇒ Boolean
12 13 14 15 |
# File 'lib/jschematic/attributes/max_length.rb', line 12 def accepts?(instance) return true unless String === instance (instance.length >= @length) || fail_validation!("minimum length of #{@length}", instance.length) end |