Class: Sandals::NumberField
- Inherits:
-
Object
- Object
- Sandals::NumberField
- Includes:
- Actionable, FieldValidation
- Defined in:
- lib/sandals/view.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes included from FieldValidation
Instance Method Summary collapse
- #change(value) ⇒ Object
-
#initialize(id, label, value:, action:, error: nil) ⇒ NumberField
constructor
A new instance of NumberField.
Methods included from FieldValidation
Constructor Details
#initialize(id, label, value:, action:, error: nil) ⇒ NumberField
Returns a new instance of NumberField.
340 341 342 343 344 345 346 |
# File 'lib/sandals/view.rb', line 340 def initialize(id, label, value:, action:, error: nil) @id = id @label = label.to_s @value = value initialize_error(error) @action = action end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
338 339 340 |
# File 'lib/sandals/view.rb', line 338 def id @id end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
338 339 340 |
# File 'lib/sandals/view.rb', line 338 def label @label end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
338 339 340 |
# File 'lib/sandals/view.rb', line 338 def value @value end |
Instance Method Details
#change(value) ⇒ Object
348 349 350 |
# File 'lib/sandals/view.rb', line 348 def change(value) execute_action(number(value)) end |