Module: MIDIMessage::Constant::Name

Extended by:
Name
Included in:
Name
Defined in:
lib/midi-message/constant.rb

Instance Method Summary collapse

Instance Method Details

#match?(key, other) ⇒ Boolean

Parameters:

  • key (Symbol, String)
  • other (Symbol, String)

Returns:

  • (Boolean)


39
40
41
42
# File 'lib/midi-message/constant.rb', line 39

def match?(key, other)
  match_key = key.to_s.downcase
  [match_key, Name.underscore(match_key)].include?(other.to_s.downcase)
end

#underscore(string) ⇒ String

eg “Control Change” -> “control_change”

Parameters:

  • string (Symbol, String)

Returns:

  • (String)


32
33
34
# File 'lib/midi-message/constant.rb', line 32

def underscore(string)
  string.to_s.downcase.gsub(/(\ )+/, "_")
end