Class: DAP::ProtocolMessage
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(values) ⇒ ProtocolMessage
constructor
A new instance of ProtocolMessage.
Methods inherited from Base
#[], build, empty, many, one_of, properties, property, property_names, #to_wire, transform, #validate!
Constructor Details
#initialize(values) ⇒ ProtocolMessage
Returns a new instance of ProtocolMessage.
22 23 24 25 26 |
# File 'lib/dap/protocol_message.rb', line 22 def initialize(values) super(values) @seq = values[:seq] || DAP::ProtocolMessage.seq @type = self.class.type end |
Class Method Details
.from(values) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/dap/protocol_message.rb', line 10 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 |
.types ⇒ Object
2 3 4 5 6 7 8 |
# File 'lib/dap/protocol_message.rb', line 2 def self.types @types ||= { request: DAP::Request, event: DAP::Event, response: DAP::Response, } end |