Module: MIDIEvents::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
36 37 38 39 |
# File 'lib/midi-events/constant.rb', line 36 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”
29 30 31 |
# File 'lib/midi-events/constant.rb', line 29 def underscore(string) string.to_s.downcase.gsub(/(\ )+/, '_') end |