Module: Solargraph::YardMap::Mapper::ToConstant

Extended by:
Helpers
Defined in:
lib/solargraph/yard_map/mapper/to_constant.rb

Class Method Summary collapse

Methods included from Helpers

create_closure_namespace_for, object_location

Class Method Details

.make(code_object, closure = nil, spec = nil) ⇒ Pin::Constant

Parameters:

  • code_object (YARD::CodeObjects::Base)
  • closure (Pin::Closure, nil) (defaults to: nil)
  • spec (Gem::Specification, nil) (defaults to: nil)

Returns:



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/solargraph/yard_map/mapper/to_constant.rb', line 13

def self.make code_object, closure = nil, spec = nil
  closure ||= create_closure_namespace_for(code_object, spec)

  Pin::Constant.new(
    location: object_location(code_object, spec),
    closure: closure,
    name: code_object.name.to_s,
    comments: code_object.docstring ? code_object.docstring.all.to_s : '',
    visibility: code_object.visibility,
    source: :yardoc
  )
end