module Patch::IO::OSC::Action

Find and identify OSC Actions

Public Instance Methods

find_by_address(actions, address) click to toggle source

Find an action by its OSC address @param [Array<Hash>] actions @param [String] address @return [Hash]

# 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) click to toggle source

Is the given action OSC? @param [Hash] action @return [Boolean]

# File lib/patch/io/osc/action.rb, line 15
def osc?(action)
  !action[:osc].nil?
end
osc_actions(actions) click to toggle source

Filter the given actions only to return OSC actions @param [Array<Hash>] actions @return [Array<Hash>]

# File lib/patch/io/osc/action.rb, line 22
def osc_actions(actions)
  actions.select { |action| osc?(action) }
end