Class: Shmidi::Switch

Inherits:
LedButton show all
Defined in:
lib/shmidi/switch.rb

Constant Summary collapse

CTYPE =
:SWI

Instance Attribute Summary collapse

Attributes inherited from LedButton

#button, #led

Attributes inherited from Control

#channel, #note

Attributes included from Base

#_attachments, #_deleted, #_id, #_rev, #version

Instance Method Summary collapse

Methods inherited from Control

#id, #socket

Methods included from Base

#[], #[]=, #clone, #dump, #etag, included, #init, #inspect, #reset, #to_hash, #to_s

Constructor Details

#initialize(id, socket, channel, note, led_note = nil) ⇒ Switch

Returns a new instance of Switch.



6
7
8
9
10
# File 'lib/shmidi/switch.rb', line 6

def initialize(id, socket, channel, note, led_note = nil)
  super(id, socket, channel, note, led_note)
  @switch_state = false
  @on_switch = []
end

Instance Attribute Details

#switch_stateObject (readonly)

Returns the value of attribute switch_state.



5
6
7
# File 'lib/shmidi/switch.rb', line 5

def switch_state
  @switch_state
end

Instance Method Details

#on_switch_state(&block) ⇒ Object



12
13
14
# File 'lib/shmidi/switch.rb', line 12

def on_switch_state(&block)
  @on_switch << block
end