Class: PuppetEditorServices::Protocol::DebugAdapterMessages::Response

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

Overview

interface Response extends ProtocolMessage {

    /** Sequence number of the corresponding request. */
    request_seq: number;
    /** Outcome of the request. */
    success: boolean;
    /** The command requested. */
    command: string;
    /** Contains error message if success == false. */
    message?: string;
    /** Contains request result if success is true and optional error details if success is false. */
    body?: any;
}

Instance Attribute Summary collapse

Attributes inherited from ProtocolMessage

#seq, #type

Instance Method Summary collapse

Methods inherited from ProtocolMessage

#to_json

Constructor Details

#initialize(initial_hash = nil) ⇒ Response

Returns a new instance of Response.



116
117
118
119
120
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 116

def initialize(initial_hash = nil)
  super
  from_h!(initial_hash) unless initial_hash.nil?
  self.type = 'response'
end

Instance Attribute Details

#bodyObject

type: number # type: boolean # type: string # type: string # type: any



114
115
116
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 114

def body
  @body
end

#commandObject

type: number # type: boolean # type: string # type: string # type: any



114
115
116
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 114

def command
  @command
end

#messageObject

type: number # type: boolean # type: string # type: string # type: any



114
115
116
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 114

def message
  @message
end

#request_seqObject

type: number # type: boolean # type: string # type: string # type: any



114
115
116
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 114

def request_seq
  @request_seq
end

#successObject

type: number # type: boolean # type: string # type: string # type: any



114
115
116
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 114

def success
  @success
end

Instance Method Details

#from_h!(value) ⇒ Object



122
123
124
125
126
127
128
129
130
131
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 122

def from_h!(value)
  value = {} if value.nil?
  super
  self.request_seq = value['request_seq']
  self.success = value['success']
  self.command = value['command']
  self.message = value['message']
  self.body = value['body']
  self
end

#to_hObject



133
134
135
136
137
138
139
140
141
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 133

def to_h
  super.tap do |hash|
    hash['request_seq'] = request_seq
    hash['success'] = success
    hash['command'] = command
    hash['message'] = message unless message.nil?
    hash['body'] = body unless body.nil?
  end
end