module Solargraph::YardMap::Mapper::ToConstant

Public Class Methods

make(code_object, closure = nil, spec = nil) click to toggle source
# File lib/solargraph/yard_map/mapper/to_constant.rb, line 8
def self.make code_object, closure = nil, spec = nil
  closure ||= Solargraph::Pin::Namespace.new(
    name: code_object.namespace.to_s,
    gates: [code_object.namespace.to_s]
  )
  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
  )
end