Class: UnderOs::UI::Switch

Inherits:
View
  • Object
show all
Includes:
Editable
Defined in:
lib/under_os/ui/switch.rb

Constant Summary

Constants included from Editable

Editable::KEYBOARDS

Constants included from Wrap

Wrap::INSTANCES_CACHE, Wrap::RAW_WRAPS_MAP, Wrap::WRAPS_TAGS_MAP

Instance Method Summary collapse

Methods included from Editable

#keyboard, #keyboard=, #placeholder, #placeholder=

Methods inherited from View

#inspect

Methods included from Manipulation

#append, #clear, #insert, #insertTo, #prepend, #remove

Methods included from Traversing

#children, #empty?, #find, #first, #matches, #parent, #siblings

Methods included from Dimensions

#position, #position=, #size, #size=

Methods included from Animation

#animate, #fade_in, #fade_out, #highlight

Methods included from Commons

#data, #data=, #hidden, #hide, #id, #id=, #page, #show, #tagName, #toggle, #visible

Methods included from Styles

#addClass, #className, #className=, #classNames, #classNames=, #hasClass, #radioClass, #removeClass, #repaint, #style, #style=, #toggleClass

Methods included from Events

#emit, #off, #on, #on=

Methods included from Wrap

included

Constructor Details

#initialize(options = {}) ⇒ Switch

Returns a new instance of Switch.



6
7
8
9
10
11
# File 'lib/under_os/ui/switch.rb', line 6

def initialize(options={})
  super

  self.value   = options[:value]   if options[:value]
  self.checked = options[:checked] if options[:checked]
end

Instance Method Details

#checkedObject



21
22
23
# File 'lib/under_os/ui/switch.rb', line 21

def checked
  @_.on?
end

#checked=(flag) ⇒ Object



25
26
27
# File 'lib/under_os/ui/switch.rb', line 25

def checked=(flag)
  @_.setOn flag, animated: true
end

#valueObject



13
14
15
# File 'lib/under_os/ui/switch.rb', line 13

def value
  @_value
end

#value=(value) ⇒ Object



17
18
19
# File 'lib/under_os/ui/switch.rb', line 17

def value=(value)
  @_value = value # just saving it on the instance
end