Class: Yoda::Parsing::Scopes::ModuleDefinition

Inherits:
Base
  • Object
show all
Defined in:
lib/yoda/parsing/scopes/module_definition.rb

Overview

Wrapper class for class node. “‘ (module (const nil :Foo) (nil)) “module Foo; end”

~~~~~~ keyword
            ~~~ end

“‘

Instance Attribute Summary

Attributes inherited from Base

#child_scopes, #method_definitions, #node, #parent

Instance Method Summary collapse

Methods inherited from Base

#ancestor_scopes, #find_evaluation_root_scope, #initialize, #inner_location?, #method?

Constructor Details

This class inherits a constructor from Yoda::Parsing::Scopes::Base

Instance Method Details

#body_nodeObject



21
22
23
# File 'lib/yoda/parsing/scopes/module_definition.rb', line 21

def body_node
  node.children.last
end

#body_nodesObject



17
18
19
# File 'lib/yoda/parsing/scopes/module_definition.rb', line 17

def body_nodes
  [body_node]
end

#const_nodeObject



13
14
15
# File 'lib/yoda/parsing/scopes/module_definition.rb', line 13

def const_node
  @const_node ||= NodeObjects::ConstNode.new(node.children[0])
end

#kindObject



25
26
27
# File 'lib/yoda/parsing/scopes/module_definition.rb', line 25

def kind
  :module
end

#scope_nameString

Returns:

  • (String)


30
31
32
# File 'lib/yoda/parsing/scopes/module_definition.rb', line 30

def scope_name
  const_node.to_s(parent.scope_name)
end