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
readonly
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.
326 327 328 329 330 331 332 333 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 326 def initialize(out: $stdout, colors: true, indent_level: 0, prefix: nil) super(out: out, colors: colors, indent_level: indent_level) @seen = T.let(Set.new, T::Set[Integer]) @out = out @colors = colors @indent_level = indent_level @prefix = prefix end |
Instance Attribute Details
#prefix ⇒ Object
Returns the value of attribute prefix.
316 317 318 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 316 def prefix @prefix end |
#seen ⇒ Object (readonly)
Returns the value of attribute seen.
313 314 315 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 313 def seen @seen end |
Instance Method Details
#clean_uri(uri) ⇒ Object
348 349 350 351 352 353 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 348 def clean_uri(uri) prefix = self.prefix return uri unless prefix uri.delete_prefix(prefix) end |
#print_list(objects) ⇒ Object
356 357 358 359 360 361 362 363 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 356 def print_list(objects) objects.each do |object| printt print("* ") print_object(object) printn end end |
#print_object(object) ⇒ Object
336 337 338 339 340 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 336 def print_object(object) return unless object object.accept_printer(self) end |
#print_objects(objects) ⇒ Object
343 344 345 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 343 def print_objects(objects) objects.each { |object| print_object(object) } end |