Class: Spoom::LSP::SymbolPrinter
- Extended by:
- T::Sig
- Defined in:
- lib/spoom/sorbet/lsp/structures.rb
Instance Attribute Summary collapse
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#seen ⇒ Object
Returns the value of attribute seen.
Attributes inherited from Printer
Instance Method Summary collapse
- #clean_uri(uri) ⇒ Object
-
#initialize(out: $stdout, colors: true, indent_level: 0, prefix: nil) ⇒ SymbolPrinter
constructor
A new instance of SymbolPrinter.
- #print_list(objects) ⇒ Object
- #print_object(object) ⇒ Object
- #print_objects(objects) ⇒ Object
Methods inherited from Printer
#colorize, #dedent, #indent, #print, #print_colored, #printl, #printn, #printt
Methods included from Colorize
Constructor Details
#initialize(out: $stdout, colors: true, indent_level: 0, prefix: nil) ⇒ SymbolPrinter
Returns a new instance of SymbolPrinter.
276 277 278 279 280 281 282 283 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 276 def initialize(out: $stdout, colors: true, indent_level: 0, prefix: nil) super(out: out, colors: colors, indent_level: indent_level) @seen = Set.new @out = out @colors = colors @indent_level = indent_level @prefix = prefix end |
Instance Attribute Details
#prefix ⇒ Object
Returns the value of attribute prefix.
266 267 268 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 266 def prefix @prefix end |
#seen ⇒ Object
Returns the value of attribute seen.
266 267 268 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 266 def seen @seen end |
Instance Method Details
#clean_uri(uri) ⇒ Object
297 298 299 300 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 297 def clean_uri(uri) return uri unless prefix uri.delete_prefix(prefix) end |
#print_list(objects) ⇒ Object
303 304 305 306 307 308 309 310 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 303 def print_list(objects) objects.each do |object| printt print "* " print_object(object) printn end end |
#print_object(object) ⇒ Object
286 287 288 289 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 286 def print_object(object) return unless object object.accept_printer(self) end |
#print_objects(objects) ⇒ Object
292 293 294 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 292 def print_objects(objects) objects.each { |object| print_object(object) } end |