Class: LanguageServer::Protocol::Interface::Command
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::Command
- Defined in:
- lib/language_server/protocol/interface/command.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#arguments ⇒ LSPAny[]
Arguments that the command handler should be invoked with.
-
#command ⇒ string
The identifier of the actual command handler.
-
#initialize(title:, command:, arguments: nil) ⇒ Command
constructor
A new instance of Command.
-
#title ⇒ string
Title of the command, like ‘save`.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(title:, command:, arguments: nil) ⇒ Command
Returns a new instance of Command.
5 6 7 8 9 10 11 12 13 |
# File 'lib/language_server/protocol/interface/command.rb', line 5 def initialize(title:, command:, arguments: nil) @attributes = {} @attributes[:title] = title @attributes[:command] = command @attributes[:arguments] = arguments if arguments @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
40 41 42 |
# File 'lib/language_server/protocol/interface/command.rb', line 40 def attributes @attributes end |
Instance Method Details
#arguments ⇒ LSPAny[]
Arguments that the command handler should be invoked with.
36 37 38 |
# File 'lib/language_server/protocol/interface/command.rb', line 36 def arguments attributes.fetch(:arguments) end |
#command ⇒ string
The identifier of the actual command handler.
27 28 29 |
# File 'lib/language_server/protocol/interface/command.rb', line 27 def command attributes.fetch(:command) end |
#title ⇒ string
Title of the command, like ‘save`.
19 20 21 |
# File 'lib/language_server/protocol/interface/command.rb', line 19 def title attributes.fetch(:title) end |
#to_hash ⇒ Object
42 43 44 |
# File 'lib/language_server/protocol/interface/command.rb', line 42 def to_hash attributes end |
#to_json(*args) ⇒ Object
46 47 48 |
# File 'lib/language_server/protocol/interface/command.rb', line 46 def to_json(*args) to_hash.to_json(*args) end |