Class: DAP::ProtocolMessage
Overview
Base class of requests, responses, and events.
Class Method Summary collapse
-
.from(values) ⇒ Object
Create a protocol message from attribute values.
-
.types ⇒ Hash<Symbol,Class>
Valid protocol message types.
Instance Method Summary collapse
-
#initialize(values) ⇒ ProtocolMessage
constructor
Create a new instance of the receiver.
Methods inherited from Base
#[], build, empty, many, one_of, properties, property, property_names, #to_wire, transform, #validate!
Constructor Details
#initialize(values) ⇒ ProtocolMessage
Create a new instance of the receiver.
33 34 35 36 37 |
# File 'lib/dap/protocol_message.rb', line 33 def initialize(values) super(values) @seq = values[:seq] || DAP::ProtocolMessage.seq @type = self.class.type end |
Class Method Details
.from(values) ⇒ Object
Create a protocol message from attribute values.
15 16 17 18 19 20 21 22 23 |
# File 'lib/dap/protocol_message.rb', line 15 def self.from(values) build(values) do |v| key = v[:type]&.to_sym raise "#{name}.type missing" if key.nil? raise "Unknown #{name}.type #{key}" unless types.key?(key) types[key] end end |