Module: Bewildr::ControlPatterns::TogglePatternForCheckBox

Defined in:
lib/bewildr/control_patterns/toggle_pattern.rb

Instance Method Summary collapse

Instance Method Details

#checkObject

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

Returns:

  • (Boolean)


42
43
44
# File 'lib/bewildr/control_patterns/toggle_pattern.rb', line 42

def checked?
  state == :on
end

#checked_stateObject

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

Returns:

  • (Boolean)


52
53
54
# File 'lib/bewildr/control_patterns/toggle_pattern.rb', line 52

def indeterminate?
  state == :indeterminate
end

#uncheckObject

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

Returns:

  • (Boolean)


47
48
49
# File 'lib/bewildr/control_patterns/toggle_pattern.rb', line 47

def unchecked?
  state == :off
end