Class: RubyDetective::AST::Nodes::ModuleDeclarationNode

Inherits:
GenericNode
  • Object
show all
Defined in:
lib/ruby_detective/ast/nodes/module_declaration_node.rb

Constant Summary collapse

MODULE_NAME_NODE_INDEX =
0

Instance Attribute Summary

Attributes inherited from GenericNode

#ast_node, #children, #file_path, #parent_node

Instance Method Summary collapse

Methods inherited from GenericNode

#absolute_path_sign_node?, #class_declaration_node?, #constant_reference_node?, #first_line, #generic_node?, #initialize, #last_line, #module_declaration_node?, #namespace, #query, #raw_children, #short_namespace, #value_node?

Constructor Details

This class inherits a constructor from RubyDetective::AST::Nodes::GenericNode

Instance Method Details

#declared_namespaceObject

TODO: Add support for inline namespacing (ex class Foo::Bar)



11
12
13
# File 'lib/ruby_detective/ast/nodes/module_declaration_node.rb', line 11

def declared_namespace
  [module_name]
end

#module_nameObject



6
7
8
# File 'lib/ruby_detective/ast/nodes/module_declaration_node.rb', line 6

def module_name
  children[MODULE_NAME_NODE_INDEX].constant_name
end

#typeObject



15
16
17
# File 'lib/ruby_detective/ast/nodes/module_declaration_node.rb', line 15

def type
  :module
end