Module: Solargraph::YardMap::Helpers

Included in:
Mapper::ToConstant, Mapper::ToMethod, Mapper::ToNamespace, ToMethod
Defined in:
lib/solargraph/yard_map/helpers.rb

Class Method Summary collapse

Class Method Details

.object_location(code_object, spec) ⇒ Solargraph::Location?

Parameters:

  • code_object (YARD::CodeObjects::Base)
  • spec (Gem::Specification)

Returns:



9
10
11
12
13
# File 'lib/solargraph/yard_map/helpers.rb', line 9

def object_location code_object, spec
  return nil if spec.nil? || code_object.nil? || code_object.file.nil? || code_object.line.nil?
  file = File.join(spec.full_gem_path, code_object.file)
  Solargraph::Location.new(file, Solargraph::Range.from_to(code_object.line - 1, 0, code_object.line - 1, 0))
end