Class: Solargraph::YardMap::ToMethod

Inherits:
Object
  • Object
show all
Extended by:
Helpers
Defined in:
lib/solargraph/yard_map/to_method.rb

Instance Method Summary collapse

Methods included from Helpers

object_location

Instance Method Details

#make(code_object, name = nil, scope = nil, visibility = nil, closure = nil, spec = nil) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/solargraph/yard_map/to_method.rb', line 59

def make code_object, name = nil, scope = nil, visibility = nil, closure = nil, spec = nil
  closure ||= Solargraph::Pin::Namespace.new(
    name: code_object.namespace.to_s,
    gates: [code_object.namespace.to_s]
  )
  location = object_location(code_object, spec)
  comments = code_object.docstring ? code_object.docstring.all.to_s : ''
  Pin::Method.new(
    location: location,
    closure: closure,
    name: name || code_object.name.to_s,
    comments: comments,
    scope: scope || code_object.scope,
    visibility: visibility || code_object.visibility,
    parameters: InnerMethods.get_parameters(code_object, location, comments),
    explicit: code_object.is_explicit?
  )
end