class LanguageServer::Protocol::Interface::ResponseMessage

Attributes

attributes[R]

Public Class Methods

new(jsonrpc:, id:, result: nil, error: nil) click to toggle source
# File lib/language_server/protocol/interface/response_message.rb, line 5
def initialize(jsonrpc:, id:, result: nil, error: nil)
  @attributes = {}

  @attributes[:jsonrpc] = jsonrpc
  @attributes[:id] = id
  @attributes[:result] = result if result
  @attributes[:error] = error if error

  @attributes.freeze
end

Public Instance Methods

error() click to toggle source

The error object in case a request fails.

@return [ResponseError]

# File lib/language_server/protocol/interface/response_message.rb, line 42
def error
  attributes.fetch(:error)
end
id() click to toggle source

The request id.

@return [string | number]

# File lib/language_server/protocol/interface/response_message.rb, line 25
def id
  attributes.fetch(:id)
end
jsonrpc() click to toggle source

@return [string]

# File lib/language_server/protocol/interface/response_message.rb, line 17
def jsonrpc
  attributes.fetch(:jsonrpc)
end
result() click to toggle source

The result of a request. This member is REQUIRED on success. This member MUST NOT exist if there was an error invoking the method.

@return [string | number | boolean | object]

# File lib/language_server/protocol/interface/response_message.rb, line 34
def result
  attributes.fetch(:result)
end
to_hash() click to toggle source
# File lib/language_server/protocol/interface/response_message.rb, line 48
def to_hash
  attributes
end
to_json(*args) click to toggle source
# File lib/language_server/protocol/interface/response_message.rb, line 52
def to_json(*args)
  to_hash.to_json(*args)
end