Class: Spoom::LSP::Range
- Inherits:
-
Object
- Object
- Spoom::LSP::Range
- Includes:
- PrintableSymbol
- Defined in:
- lib/spoom/sorbet/lsp/structures.rb
Instance Attribute Summary collapse
-
#end_pos ⇒ Object
readonly
: Position.
-
#start_pos ⇒ Object
readonly
: Position.
Class Method Summary collapse
-
.from_json(json) ⇒ Object
: (Hash[untyped, untyped] json) -> Range.
Instance Method Summary collapse
-
#accept_printer(printer) ⇒ Object
: (SymbolPrinter printer) -> void.
-
#initialize(start_pos:, end_pos:) ⇒ Range
constructor
: (start_pos: Position, end_pos: Position) -> void.
-
#to_s ⇒ Object
: -> String.
Constructor Details
#initialize(start_pos:, end_pos:) ⇒ Range
: (start_pos: Position, end_pos: Position) -> void
63 64 65 66 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 63 def initialize(start_pos:, end_pos:) @start_pos = start_pos @end_pos = end_pos end |
Instance Attribute Details
#end_pos ⇒ Object (readonly)
: Position
60 61 62 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 60 def end_pos @end_pos end |
#start_pos ⇒ Object (readonly)
: Position
57 58 59 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 57 def start_pos @start_pos end |
Class Method Details
.from_json(json) ⇒ Object
: (Hash[untyped, untyped] json) -> Range
70 71 72 73 74 75 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 70 def from_json(json) Range.new( start_pos: Position.from_json(json["start"]), end_pos: Position.from_json(json["end"]), ) end |
Instance Method Details
#accept_printer(printer) ⇒ Object
: (SymbolPrinter printer) -> void
80 81 82 83 84 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 80 def accept_printer(printer) printer.print_object(start_pos) printer.print_colored("-", Color::LIGHT_BLACK) printer.print_object(end_pos) end |
#to_s ⇒ Object
: -> String
87 88 89 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 87 def to_s "#{start_pos}-#{end_pos}" end |