Class: MicroOSC::Context
- Inherits:
-
Object
- Object
- MicroOSC::Context
- Extended by:
- Forwardable
- Includes:
- OSCAccessible
- Defined in:
- lib/micro-osc/context.rb,
lib/micro-osc/shorthand.rb
Instance Attribute Summary collapse
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
-
#edit(&block) ⇒ Object
open a block for editing/live coding in this Context.
-
#initialize(options = {}, &block) ⇒ Context
constructor
A new instance of Context.
-
#input_ports ⇒ Object
shortcut to an array of port numbers.
- #join(options = {}) ⇒ Object (also: #wait_for_input)
- #method_missing(m, *a, &b) ⇒ Object
-
#repeat ⇒ Object
(also: #r)
repeat the last command.
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *a, &b) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/micro-osc/context.rb', line 45 def method_missing(m, *a, &b) outp = nil = a.last.kind_of?(Hash) ? a.last : {} do_output = [:output] || true outp = super @state.record(m, a, b, outp) end |
Instance Attribute Details
#state ⇒ Object (readonly)
Returns the value of attribute state.
12 13 14 |
# File 'lib/micro-osc/context.rb', line 12 def state @state end |
Instance Method Details
#edit(&block) ⇒ Object
open a block for editing/live coding in this Context
26 27 28 |
# File 'lib/micro-osc/context.rb', line 26 def edit(&block) self.instance_eval(&block) end |
#input_ports ⇒ Object
shortcut to an array of port numbers
41 42 43 |
# File 'lib/micro-osc/context.rb', line 41 def input_ports @osc_receiver.servers.keys end |
#join(options = {}) ⇒ Object Also known as: wait_for_input
53 54 55 |
# File 'lib/micro-osc/context.rb', line 53 def join( = {}) osc_join() end |
#repeat ⇒ Object Also known as: r
repeat the last command
36 37 38 |
# File 'lib/micro-osc/context.rb', line 36 def repeat self.send(@state.last_command[:method], *@state.last_command[:args]) unless @state.last_command.nil? end |