Class: MIDIMessage::Constant::Group
- Inherits:
-
Object
- Object
- MIDIMessage::Constant::Group
- Defined in:
- lib/midi-message/constant.rb
Overview
MIDI Constant container
Instance Attribute Summary collapse
-
#constants ⇒ Object
readonly
Returns the value of attribute constants.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Class Method Summary collapse
-
.all ⇒ Array<ConstantGroup>
All constant groups.
-
.find(key) ⇒ ConstantGroup
(also: [])
Find a constant group by its key.
Instance Method Summary collapse
-
#find(name) ⇒ Constant::Map
Find a constant by its name.
-
#find_by_value(value) ⇒ Constant::Map
Find a constant by its value.
-
#initialize(key, constants) ⇒ Group
constructor
A new instance of Group.
Constructor Details
Instance Attribute Details
#constants ⇒ Object (readonly)
Returns the value of attribute constants.
49 50 51 |
# File 'lib/midi-message/constant.rb', line 49 def constants @constants end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
49 50 51 |
# File 'lib/midi-message/constant.rb', line 49 def key @key end |
Class Method Details
.all ⇒ Array<ConstantGroup>
All constant groups
76 77 78 79 |
# File 'lib/midi-message/constant.rb', line 76 def all ensure_initialized @groups end |
Instance Method Details
#find(name) ⇒ Constant::Map
Find a constant by its name
61 62 63 |
# File 'lib/midi-message/constant.rb', line 61 def find(name) @constants.find { |const| Name.match?(const.key, name) } end |
#find_by_value(value) ⇒ Constant::Map
Find a constant by its value
68 69 70 |
# File 'lib/midi-message/constant.rb', line 68 def find_by_value(value) @constants.find { |const| Name.match?(const.value, value) } end |