Sha256: 6ce44ddfde3893be4c5c686772f19abcd440824a12183f78085a4546b517a965

Contents?: true

Size: 482 Bytes

Versions: 2

Compression:

Stored size: 482 Bytes

Contents

class UnderOs::UI::Switch < UnderOs::UI::View
  include UnderOs::UI::Editable

  wraps UISwitch, tag: 'switch'

  def initialize(options={})
    super

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

  def value
    @_value
  end

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

  def checked
    @_.on?
  end

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

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
under-os-1.1.0 lib/under_os/ui/switch.rb
under-os-1.0.0 lib/under_os/ui/switch.rb