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