Module: Patch::IO::OSC::Action
Overview
Find and identify OSC Actions
Instance Method Summary collapse
-
#find_by_address(actions, address) ⇒ Hash
Find an action by its OSC address.
-
#osc?(action) ⇒ Boolean
Is the given action OSC?.
-
#osc_actions(actions) ⇒ Array<Hash>
Filter the given actions only to return OSC actions.
Instance Method Details
#find_by_address(actions, address) ⇒ Hash
Find an action by its OSC address
30 31 32 33 34 35 |
# File 'lib/patch/io/osc/action.rb', line 30 def find_by_address(actions, address) osc_actions(actions).find do |action| regex = Regexp.new(action[:osc][:address]) address.match(regex) end end |
#osc?(action) ⇒ Boolean
Is the given action OSC?
15 16 17 |
# File 'lib/patch/io/osc/action.rb', line 15 def osc?(action) !action[:osc].nil? end |
#osc_actions(actions) ⇒ Array<Hash>
Filter the given actions only to return OSC actions
22 23 24 |
# File 'lib/patch/io/osc/action.rb', line 22 def osc_actions(actions) actions.select { |action| osc?(action) } end |