Class: Mui::Lsp::Protocol::Position
- Inherits:
-
Object
- Object
- Mui::Lsp::Protocol::Position
- Defined in:
- lib/mui/lsp/protocol/position.rb
Overview
LSP Position (0-indexed line and character)
Instance Attribute Summary collapse
-
#character ⇒ Object
Returns the value of attribute character.
-
#line ⇒ Object
Returns the value of attribute line.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(line:, character:) ⇒ Position
constructor
A new instance of Position.
- #to_h ⇒ Object
Constructor Details
#initialize(line:, character:) ⇒ Position
Returns a new instance of Position.
10 11 12 13 |
# File 'lib/mui/lsp/protocol/position.rb', line 10 def initialize(line:, character:) @line = line @character = character end |
Instance Attribute Details
#character ⇒ Object
Returns the value of attribute character.
8 9 10 |
# File 'lib/mui/lsp/protocol/position.rb', line 8 def character @character end |
#line ⇒ Object
Returns the value of attribute line.
8 9 10 |
# File 'lib/mui/lsp/protocol/position.rb', line 8 def line @line end |
Class Method Details
.from_hash(hash) ⇒ Object
19 20 21 |
# File 'lib/mui/lsp/protocol/position.rb', line 19 def self.from_hash(hash) new(line: hash["line"] || hash[:line], character: hash["character"] || hash[:character]) end |
Instance Method Details
#==(other) ⇒ Object
23 24 25 26 27 |
# File 'lib/mui/lsp/protocol/position.rb', line 23 def ==(other) return false unless other.is_a?(Position) @line == other.line && @character == other.character end |
#to_h ⇒ Object
15 16 17 |
# File 'lib/mui/lsp/protocol/position.rb', line 15 def to_h { line: @line, character: @character } end |