Class: Webmidi::Message::UMP::Base
- Defined in:
- lib/webmidi/message/ump.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#message_type ⇒ Object
readonly
Returns the value of attribute message_type.
Attributes inherited from Base
Instance Method Summary collapse
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(message_type:, group: 0, timestamp: nil) ⇒ Base
constructor
A new instance of Base.
- #with(**changes) ⇒ Object
Methods inherited from Base
#==, #channel, #deconstruct, #eql?, #hash, #same_bytes?, #same_event?, #to_binary, #to_bytes, #to_hex
Constructor Details
#initialize(message_type:, group: 0, timestamp: nil) ⇒ Base
Returns a new instance of Base.
92 93 94 95 96 97 98 |
# File 'lib/webmidi/message/ump.rb', line 92 def initialize(message_type:, group: 0, timestamp: nil) () validate_range!(group, "Group", 0, 15) @message_type = @group = group super(timestamp: ) end |
Instance Attribute Details
#group ⇒ Object (readonly)
Returns the value of attribute group.
90 91 92 |
# File 'lib/webmidi/message/ump.rb', line 90 def group @group end |
#message_type ⇒ Object (readonly)
Returns the value of attribute message_type.
90 91 92 |
# File 'lib/webmidi/message/ump.rb', line 90 def @message_type end |
Instance Method Details
#deconstruct_keys(keys) ⇒ Object
100 101 102 |
# File 'lib/webmidi/message/ump.rb', line 100 def deconstruct_keys(keys) {message_type: @message_type, group: @group} end |
#with(**changes) ⇒ Object
104 105 106 107 108 |
# File 'lib/webmidi/message/ump.rb', line 104 def with(**changes) changes = changes.dup = changes.key?(:timestamp) ? changes.delete(:timestamp) : @timestamp self.class.new(**constructor_attributes.merge(changes), timestamp: ) end |