Class: Webmidi::Message::UMP::Raw
- Defined in:
- lib/webmidi/message/ump.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#words ⇒ Object
readonly
Returns the value of attribute words.
Attributes inherited from Base
Attributes inherited from Base
Instance Method Summary collapse
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(message_type:, words:, group: 0, timestamp: nil) ⇒ Raw
constructor
A new instance of Raw.
- #to_bytes ⇒ Object
- #with(**changes) ⇒ Object
Methods inherited from Base
#==, #channel, #deconstruct, #eql?, #hash, #same_bytes?, #same_event?, #to_binary, #to_hex
Constructor Details
#initialize(message_type:, words:, group: 0, timestamp: nil) ⇒ Raw
Returns a new instance of Raw.
134 135 136 137 138 139 140 141 142 |
# File 'lib/webmidi/message/ump.rb', line 134 def initialize(message_type:, words:, group: 0, timestamp: nil) words = normalize_words!(words) () validate_word_count!(, words) validate_range!(group, "Group", 0, 15) validate_word_header!(, group, words.first) @words = words.dup.freeze super(message_type: , group: group, timestamp: ) end |
Instance Attribute Details
#words ⇒ Object (readonly)
Returns the value of attribute words.
132 133 134 |
# File 'lib/webmidi/message/ump.rb', line 132 def words @words end |
Instance Method Details
#deconstruct_keys(keys) ⇒ Object
148 149 150 |
# File 'lib/webmidi/message/ump.rb', line 148 def deconstruct_keys(keys) super.merge(words: @words) end |
#to_bytes ⇒ Object
144 145 146 |
# File 'lib/webmidi/message/ump.rb', line 144 def to_bytes words_to_bytes(@words) end |
#with(**changes) ⇒ Object
152 153 154 155 156 157 158 |
# File 'lib/webmidi/message/ump.rb', line 152 def with(**changes) changes = changes.dup = changes.key?(:timestamp) ? changes.delete(:timestamp) : @timestamp attributes = constructor_attributes.merge(changes) attributes[:words] = words_with_group(attributes[:words], attributes[:group]) self.class.new(**attributes, timestamp: ) end |