Class: LanguageServer::Protocol::Interface::RequestMessage
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::RequestMessage
- Defined in:
- lib/language_server/protocol/interface/request_message.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#id ⇒ string | number
The request id.
-
#initialize(jsonrpc:, id:, method:, params: nil) ⇒ RequestMessage
constructor
A new instance of RequestMessage.
- #jsonrpc ⇒ string
-
#method ⇒ string
The method to be invoked.
-
#params ⇒ any
The method’s params.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(jsonrpc:, id:, method:, params: nil) ⇒ RequestMessage
Returns a new instance of RequestMessage.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/language_server/protocol/interface/request_message.rb', line 5 def initialize(jsonrpc:, id:, method:, params: nil) @attributes = {} @attributes[:jsonrpc] = jsonrpc @attributes[:id] = id @attributes[:method] = method @attributes[:params] = params if params @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
45 46 47 |
# File 'lib/language_server/protocol/interface/request_message.rb', line 45 def attributes @attributes end |
Instance Method Details
#id ⇒ string | number
The request id.
25 26 27 |
# File 'lib/language_server/protocol/interface/request_message.rb', line 25 def id attributes.fetch(:id) end |
#jsonrpc ⇒ string
17 18 19 |
# File 'lib/language_server/protocol/interface/request_message.rb', line 17 def jsonrpc attributes.fetch(:jsonrpc) end |
#method ⇒ string
The method to be invoked.
33 34 35 |
# File 'lib/language_server/protocol/interface/request_message.rb', line 33 def method attributes.fetch(:method) end |
#params ⇒ any
The method’s params.
41 42 43 |
# File 'lib/language_server/protocol/interface/request_message.rb', line 41 def params attributes.fetch(:params) end |
#to_hash ⇒ Object
47 48 49 |
# File 'lib/language_server/protocol/interface/request_message.rb', line 47 def to_hash attributes end |
#to_json(*args) ⇒ Object
51 52 53 |
# File 'lib/language_server/protocol/interface/request_message.rb', line 51 def to_json(*args) to_hash.to_json(*args) end |