class Solargraph::Parser::Legacy::NodeProcessors::IvasgnNode

Public Instance Methods

process() click to toggle source
# File lib/solargraph/parser/legacy/node_processors/ivasgn_node.rb, line 10
def process
  loc = get_node_location(node)
  pins.push Solargraph::Pin::InstanceVariable.new(
    location: loc,
    closure: region.closure,
    name: node.children[0].to_s,
    comments: comments_for(node),
    assignment: node.children[1]
  )
  if region.visibility == :module_function
    here = get_node_start_position(node)
    named_path = named_path_pin(here)
    if named_path.is_a?(Pin::Method)
      pins.push Solargraph::Pin::InstanceVariable.new(
        location: loc,
        closure: Pin::Namespace.new(type: :module, closure: region.closure.closure, name: region.closure.name),
        name: node.children[0].to_s,
        comments: comments_for(node),
        assignment: node.children[1]
      )
    end
  end
  process_children
end