Class: Sandals::Checkbox
- Inherits:
-
Object
- Object
- Sandals::Checkbox
- 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.
Attributes included from FieldValidation
Instance Method Summary collapse
- #change(checked) ⇒ Object
- #checked? ⇒ Boolean
-
#initialize(id, label, checked:, action:, error: nil) ⇒ Checkbox
constructor
A new instance of Checkbox.
Methods included from FieldValidation
Constructor Details
#initialize(id, label, checked:, action:, error: nil) ⇒ Checkbox
Returns a new instance of Checkbox.
388 389 390 391 392 393 394 |
# File 'lib/sandals/view.rb', line 388 def initialize(id, label, checked:, action:, error: nil) @id = id @label = label.to_s @checked = checked initialize_error(error) @action = action end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
386 387 388 |
# File 'lib/sandals/view.rb', line 386 def id @id end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
386 387 388 |
# File 'lib/sandals/view.rb', line 386 def label @label end |
Instance Method Details
#change(checked) ⇒ Object
400 401 402 |
# File 'lib/sandals/view.rb', line 400 def change(checked) execute_action(checked) end |
#checked? ⇒ Boolean
396 397 398 |
# File 'lib/sandals/view.rb', line 396 def checked? @checked end |