Class: Spoom::LSP::Position
- Inherits:
-
Object
- Object
- Spoom::LSP::Position
- Includes:
- PrintableSymbol
- Defined in:
- lib/spoom/sorbet/lsp/structures.rb
Instance Attribute Summary collapse
-
#char ⇒ Object
readonly
: Integer.
-
#line ⇒ Object
readonly
: Integer.
Class Method Summary collapse
-
.from_json(json) ⇒ Object
: (Hash[untyped, untyped] json) -> Position.
Instance Method Summary collapse
-
#accept_printer(printer) ⇒ Object
: (SymbolPrinter printer) -> void.
-
#initialize(line:, char:) ⇒ Position
constructor
: (line: Integer, char: Integer) -> void.
-
#to_s ⇒ Object
: -> String.
Constructor Details
#initialize(line:, char:) ⇒ Position
: (line: Integer, char: Integer) -> void
26 27 28 29 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 26 def initialize(line:, char:) @line = line @char = char end |
Instance Attribute Details
#char ⇒ Object (readonly)
: Integer
23 24 25 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 23 def char @char end |
#line ⇒ Object (readonly)
: Integer
20 21 22 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 20 def line @line end |
Class Method Details
.from_json(json) ⇒ Object
: (Hash[untyped, untyped] json) -> Position
33 34 35 36 37 38 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 33 def from_json(json) Position.new( line: json["line"].to_i, char: json["character"].to_i, ) end |
Instance Method Details
#accept_printer(printer) ⇒ Object
: (SymbolPrinter printer) -> void
43 44 45 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 43 def accept_printer(printer) printer.print_colored("#{line}:#{char}", Color::LIGHT_BLACK) end |
#to_s ⇒ Object
: -> String
48 49 50 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 48 def to_s "#{line}:#{char}" end |