Class: Solargraph::Parser::ParserGem::NodeProcessors::ClassDefinition::ClassNode

Inherits:
NodeProcessor::Base
  • Object
show all
Defined in:
lib/solargraph/parser/parser_gem/node_processors/class_definition.rb

Instance Attribute Summary

Attributes inherited from NodeProcessor::Base

#ivars, #locals, #node, #pins, #region

Instance Method Summary collapse

Methods inherited from NodeProcessor::Base

#initialize

Constructor Details

This class inherits a constructor from Solargraph::Parser::NodeProcessor::Base

Instance Method Details

#process ⇒ Boolean

Returns continue processing the next processor of the same node.

Returns:

  • (Boolean) —

    continue processing the next processor of the same node.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/solargraph/parser/parser_gem/node_processors/class_definition.rb', line 12

def process
  definition_node = class_definition_node
  return true if definition_node.nil?

  loc = get_node_location(node)
  nspin = Solargraph::Pin::Namespace.new(
    type: :class,
    location: loc,
    closure: region.closure,
    name: definition_node.class_name,
    comments: comments_for(node),
    visibility: :public,
    gates: region.closure.gates.freeze,
    source: :class_definition
  )
  pins.push nspin

  superclass_name = definition_node.superclass_name
  if superclass_name
    pins.push Pin::Reference::Superclass.new(
      location: loc,
      closure: nspin,
      name: superclass_name,
      source: :class_definition
    )
  end

  process_children region.update(closure: nspin, visibility: :public)
  false
end