Class: Spoom::LSP::Hover
- Inherits:
-
T::Struct
- Object
- T::Struct
- Spoom::LSP::Hover
- Includes:
- PrintableSymbol
- Defined in:
- lib/spoom/sorbet/lsp/structures.rb
Class Method Summary collapse
-
.from_json(json) ⇒ Object
: (Hash[untyped, untyped] json) -> Hover.
Instance Method Summary collapse
-
#accept_printer(printer) ⇒ Object
: (SymbolPrinter printer) -> void.
-
#to_s ⇒ Object
: -> String.
Class Method Details
.from_json(json) ⇒ Object
: (Hash[untyped, untyped] json) -> Hover
24 25 26 27 28 29 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 24 def from_json(json) Hover.new( contents: json["contents"]["value"], range: json["range"] ? Range.from_json(json["range"]) : nil, ) end |
Instance Method Details
#accept_printer(printer) ⇒ Object
: (SymbolPrinter printer) -> void
34 35 36 37 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 34 def accept_printer(printer) printer.print("#{contents}\n") printer.print_object(range) if range end |
#to_s ⇒ Object
: -> String
40 41 42 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 40 def to_s "#{contents} (#{range})." end |