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.
410 411 412 413 414 415 416 |
# File 'lib/sandals/view.rb', line 410 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.
408 409 410 |
# File 'lib/sandals/view.rb', line 408 def id @id end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
408 409 410 |
# File 'lib/sandals/view.rb', line 408 def label @label end |
Instance Method Details
#change(checked) ⇒ Object
422 423 424 |
# File 'lib/sandals/view.rb', line 422 def change(checked) execute_action(checked) end |
#checked? ⇒ Boolean
418 419 420 |
# File 'lib/sandals/view.rb', line 418 def checked? @checked end |