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_node ⇒ Object



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

def body_node
  node.children.last
end

#body_nodes ⇒ Object



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

def body_nodes
  [body_node]
end

#const_node ⇒ Object



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

#kind ⇒ Object



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

def kind
  :module
end

#scope_name ⇒ String

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