Module: MIDIEvents::Constant::Name Private
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Name manipulation utilities for constant lookups
Provides methods to normalize and compare constant names in a case-insensitive manner, supporting both "Control Change" and "control_change" formats.
Class Method Summary collapse
-
.match?(key, other) ⇒ Boolean
private
Check if two names match (case-insensitive, supports underscored or spaced).
-
.underscore(string) ⇒ String
private
Convert a name to underscore format.
Instance Method Summary collapse
-
#match?(key, other) ⇒ Boolean
private
Check if two names match (case-insensitive, supports underscored or spaced).
-
#underscore(string) ⇒ String
private
Convert a name to underscore format.
Class Method Details
.match?(key, other) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Check if two names match (case-insensitive, supports underscored or spaced)
73 74 75 76 |
# File 'lib/midi-events/constant.rb', line 73 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
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert a name to underscore format
60 61 62 |
# File 'lib/midi-events/constant.rb', line 60 def underscore(string) string.to_s.downcase.gsub(/(\ )+/, '_') end |
Instance Method Details
#match?(key, other) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Check if two names match (case-insensitive, supports underscored or spaced)
73 74 75 76 |
# File 'lib/midi-events/constant.rb', line 73 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
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert a name to underscore format
60 61 62 |
# File 'lib/midi-events/constant.rb', line 60 def underscore(string) string.to_s.downcase.gsub(/(\ )+/, '_') end |