Module: Bewildr::ControlPatterns::TogglePatternForCheckBox
- Defined in:
- lib/bewildr/control_patterns/toggle_pattern.rb
Instance Method Summary collapse
-
#check ⇒ Object
Check the element.
-
#checked? ⇒ Boolean
Return true if the element is checked, false if it’s not.
-
#checked_state ⇒ Object
Returns the checked state.
-
#indeterminate? ⇒ Boolean
Return true if the element is indeterminate, false if it’s not.
-
#uncheck ⇒ Object
Uncheck the element.
-
#unchecked? ⇒ Boolean
Return true if the element is unchecked, false if it’s not.
Instance Method Details
#check ⇒ Object
Check the element
32 33 34 |
# File 'lib/bewildr/control_patterns/toggle_pattern.rb', line 32 def check set_state_to :on end |
#checked? ⇒ Boolean
Return true if the element is checked, false if it’s not
42 43 44 |
# File 'lib/bewildr/control_patterns/toggle_pattern.rb', line 42 def checked? state == :on end |
#checked_state ⇒ Object
Returns the checked state. The available states are:
:on
:off
:indeterminate
60 61 62 |
# File 'lib/bewildr/control_patterns/toggle_pattern.rb', line 60 def checked_state state end |
#indeterminate? ⇒ Boolean
Return true if the element is indeterminate, false if it’s not
52 53 54 |
# File 'lib/bewildr/control_patterns/toggle_pattern.rb', line 52 def indeterminate? state == :indeterminate end |
#uncheck ⇒ Object
Uncheck the element
37 38 39 |
# File 'lib/bewildr/control_patterns/toggle_pattern.rb', line 37 def uncheck set_state_to :off end |
#unchecked? ⇒ Boolean
Return true if the element is unchecked, false if it’s not
47 48 49 |
# File 'lib/bewildr/control_patterns/toggle_pattern.rb', line 47 def unchecked? state == :off end |