Class: RubyLsp::ResponseBuilders::DocumentSymbol
- Inherits:
-
ResponseBuilder
- Object
- ResponseBuilder
- RubyLsp::ResponseBuilders::DocumentSymbol
- Defined in:
- lib/ruby_lsp/response_builders/document_symbol.rb
Overview
: [ResponseType = Array]
Defined Under Namespace
Classes: SymbolHierarchyRoot
Instance Method Summary collapse
-
#initialize ⇒ DocumentSymbol
constructor
: -> void.
-
#last ⇒ Object
: -> (SymbolHierarchyRoot | Interface::DocumentSymbol).
-
#pop ⇒ Object
: -> Interface::DocumentSymbol?.
-
#push(symbol) ⇒ Object
(also: #<<)
: (Interface::DocumentSymbol symbol) -> void.
-
#response ⇒ Object
: -> Array.
Constructor Details
#initialize ⇒ DocumentSymbol
: -> void
19 20 21 22 |
# File 'lib/ruby_lsp/response_builders/document_symbol.rb', line 19 def initialize super @stack = [SymbolHierarchyRoot.new] #: Array[(SymbolHierarchyRoot | Interface::DocumentSymbol)] end |
Instance Method Details
#last ⇒ Object
: -> (SymbolHierarchyRoot | Interface::DocumentSymbol)
39 40 41 |
# File 'lib/ruby_lsp/response_builders/document_symbol.rb', line 39 def last @stack.last #: as !nil end |
#pop ⇒ Object
: -> Interface::DocumentSymbol?
32 33 34 35 36 |
# File 'lib/ruby_lsp/response_builders/document_symbol.rb', line 32 def pop if @stack.size > 1 @stack.pop #: as Interface::DocumentSymbol end end |
#push(symbol) ⇒ Object Also known as: <<
: (Interface::DocumentSymbol symbol) -> void
25 26 27 |
# File 'lib/ruby_lsp/response_builders/document_symbol.rb', line 25 def push(symbol) @stack << symbol end |
#response ⇒ Object
: -> Array
45 46 47 48 |
# File 'lib/ruby_lsp/response_builders/document_symbol.rb', line 45 def response @stack.first #: as !nil .children end |