Class: PuppetEditorServices::Protocol::DebugAdapterMessages::ProtocolMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet_editor_services/protocol/debug_adapter_messages.rb

Overview

Protocol message primitives interface ProtocolMessage {

    /** Sequence number. */
    seq: number;
    /** Message type.
        Values: 'request', 'response', 'event', etc.
    */
    type: string;
}

Direct Known Subclasses

Event, Request, Response

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(initial_hash = nil) ⇒ ProtocolMessage

Returns a new instance of ProtocolMessage.



18
19
20
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 18

def initialize(initial_hash = nil)
  from_h!(initial_hash)
end

Instance Attribute Details

#seqObject

type: number # type: string



16
17
18
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 16

def seq
  @seq
end

#typeObject

type: number # type: string



16
17
18
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 16

def type
  @type
end

Instance Method Details

#from_h!(value) ⇒ Object



33
34
35
36
37
38
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 33

def from_h!(value)
  value = {} if value.nil?
  self.seq = value['seq']
  self.type = value['type']
  self
end

#to_hObject



26
27
28
29
30
31
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 26

def to_h
  {
    'seq' => seq,
    'type' => type
  }
end

#to_json(*options) ⇒ Object



22
23
24
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 22

def to_json(*options)
  to_h.to_json(options)
end