Module: MIDIMessage::Constant::Name
Instance Method Summary collapse
- #match?(key, other) ⇒ Boolean
-
#underscore(string) ⇒ String
eg “Control Change” -> “control_change”.
Instance Method Details
#match?(key, other) ⇒ 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”
32 33 34 |
# File 'lib/midi-message/constant.rb', line 32 def underscore(string) string.to_s.downcase.gsub(/(\ )+/, "_") end |