Module: PuppetEditorServices::Protocol::DebugAdapterMessages

Defined in:
lib/puppet_editor_services/protocol/debug_adapter_messages.rb

Defined Under Namespace

Classes: Event, ProtocolMessage, Request, Response

Class Method Summary collapse

Class Method Details

.new_event(event_name, body_content = nil) ⇒ Object



164
165
166
167
168
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 164

def self.new_event(event_name, body_content = nil)
  Event.new(
    'event' => event_name
  ).tap { |resp| resp.body = body_content unless body_content.nil? }
end

.reply_error(request, message = nil, message_object = nil) ⇒ Object

Static message generators



145
146
147
148
149
150
151
152
153
154
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 145

def self.reply_error(request, message = nil, message_object = nil)
  Response.new(
    'request_seq' => request.seq,
    'command' => request.command,
    'success' => false
  ).tap do |resp|
    resp.message = message unless message.nil?
    resp.body = { 'error' => message_object } unless message_object.nil?
  end
end

.reply_success(request, body_content = nil) ⇒ Object



156
157
158
159
160
161
162
# File 'lib/puppet_editor_services/protocol/debug_adapter_messages.rb', line 156

def self.reply_success(request, body_content = nil)
  Response.new(
    'request_seq' => request.seq,
    'command' => request.command,
    'success' => true
  ).tap { |resp| resp.body = body_content unless body_content.nil? }
end