Class: Solargraph::YardMap::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/solargraph/yard_map/mapper.rb,
lib/solargraph/yard_map/mapper/to_method.rb,
lib/solargraph/yard_map/mapper/to_constant.rb,
lib/solargraph/yard_map/mapper/to_namespace.rb

Defined Under Namespace

Modules: ToConstant, ToMethod, ToNamespace

Instance Method Summary collapse

Constructor Details

#initialize(code_objects, spec = nil) ⇒ Mapper

Returns a new instance of Mapper.

Parameters:

  • code_objects (Array<YARD::CodeObjects::Base>)
  • spec (Gem::Specification) (defaults to: nil)


12
13
14
15
16
17
# File 'lib/solargraph/yard_map/mapper.rb', line 12

def initialize code_objects, spec = nil
  @code_objects = code_objects
  @spec = spec
  @pins = []
  @namespace_pins = {}
end

Instance Method Details

#mapArray<Pin::Base>

Returns:



20
21
22
23
24
25
26
27
28
# File 'lib/solargraph/yard_map/mapper.rb', line 20

def map
  @code_objects.each do |co|
    @pins.concat generate_pins co
  end
  # Some yardocs contain documentation for dependencies that can be
  # ignored here. The YardMap will load dependencies separately.
  @pins.keep_if { |pin| pin.location.nil? || File.file?(pin.location.filename) } if @spec
  @pins
end