Class: Shmidi::Switch
- Defined in:
- lib/shmidi/switch.rb
Constant Summary collapse
- CTYPE =
:SWI
Instance Attribute Summary collapse
-
#switch_state ⇒ Object
readonly
Returns the value of attribute switch_state.
Attributes inherited from LedButton
Attributes inherited from Control
Attributes included from Base
#_attachments, #_deleted, #_id, #_rev, #version
Instance Method Summary collapse
-
#initialize(id, socket, channel, note, led_note = nil) ⇒ Switch
constructor
A new instance of Switch.
- #on_switch_state(&block) ⇒ Object
Methods inherited from Control
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_state ⇒ Object (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 |