Class: Spoom::LSP::SymbolPrinter
- Defined in:
- lib/spoom/sorbet/lsp/structures.rb
Instance Attribute Summary collapse
-
#prefix ⇒ Object
: String?.
-
#seen ⇒ Object
readonly
: Set[Array[untyped]].
Attributes inherited from Printer
Instance Method Summary collapse
-
#clean_uri(uri) ⇒ Object
: (String uri) -> String.
-
#initialize(out: $stdout, colors: true, indent_level: 0, prefix: nil) ⇒ SymbolPrinter
constructor
: (?out: (IO | StringIO), ?colors: bool, ?indent_level: Integer, ?prefix: String?) -> void.
-
#print_list(objects) ⇒ Object
: (Array objects) -> void.
-
#print_object(object) ⇒ Object
: (PrintableSymbol? object) -> void.
-
#print_objects(objects) ⇒ Object
: (Array objects) -> void.
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
: (?out: (IO | StringIO), ?colors: bool, ?indent_level: Integer, ?prefix: String?) -> void
409 410 411 412 413 414 415 416 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 409 def initialize(out: $stdout, colors: true, indent_level: 0, prefix: nil) super(out: out, colors: colors, indent_level: indent_level) @seen = Set.new #: Set[Array[untyped]] @out = out @colors = colors @indent_level = indent_level @prefix = prefix end |
Instance Attribute Details
#prefix ⇒ Object
: String?
406 407 408 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 406 def prefix @prefix end |
#seen ⇒ Object (readonly)
: Set[Array[untyped]]
403 404 405 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 403 def seen @seen end |
Instance Method Details
#clean_uri(uri) ⇒ Object
: (String uri) -> String
431 432 433 434 435 436 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 431 def clean_uri(uri) prefix = self.prefix return uri unless prefix uri.delete_prefix(prefix) end |
#print_list(objects) ⇒ Object
: (Array objects) -> void
439 440 441 442 443 444 445 446 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 439 def print_list(objects) objects.each do |object| printt print("* ") print_object(object) printn end end |
#print_object(object) ⇒ Object
: (PrintableSymbol? object) -> void
419 420 421 422 423 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 419 def print_object(object) return unless object object.accept_printer(self) end |
#print_objects(objects) ⇒ Object
: (Array objects) -> void
426 427 428 |
# File 'lib/spoom/sorbet/lsp/structures.rb', line 426 def print_objects(objects) objects.each { |object| print_object(object) } end |