Class: RubyLsp::Ree::LinksParser

Inherits:
BasicParser show all
Defined in:
lib/ruby_lsp/ruby_lsp_ree/parsing/body_parsers/links_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BasicParser

#get_method_body, #node_name

Constructor Details

#initialize(container, package_name) ⇒ LinksParser

Returns a new instance of LinksParser.



7
8
9
10
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/body_parsers/links_parser.rb', line 7

def initialize(container, package_name)
  @container = container
  @document_package_name = package_name
end

Instance Attribute Details

#containerObject (readonly)

Returns the value of attribute container.



5
6
7
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/body_parsers/links_parser.rb', line 5

def container
  @container
end

Instance Method Details



12
13
14
15
16
17
18
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/body_parsers/links_parser.rb', line 12

def parse_links
  nodes = container.select{ |node| node_name(node) == :link || node_name(node) == :import }

  nodes.map do |link_node|
    RubyLsp::Ree::ParsedLinkNodeBuilder.build_from_node(link_node, @document_package_name)
  end
end