Class: Yadriggy::ModuleDef
- Includes:
- AstHelper
- Defined in:
- lib/yadriggy/ast.rb
Overview
Module definition.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Exprs|ASTnode
readonly
The body.
-
#name ⇒ Const|ConstPathRef
readonly
The module name.
-
#rescue ⇒ Rescue|nil
readonly
The rescue clause.
Attributes inherited from ASTnode
Class Method Summary collapse
Instance Method Summary collapse
-
#accept(evaluator) ⇒ void
A method for Visitor pattern.
-
#initialize(sexp) ⇒ ModuleDef
constructor
A new instance of ModuleDef.
- #initialize_body(bodystmt) ⇒ Object
Methods included from AstHelper
#has_tag?, #to_node, #to_nodes
Methods inherited from ASTnode
#add_child, #add_children, #const_value, #const_value_in_class, #get_context_class, #get_receiver_object, #is_proc?, #pretty_print, #root, #source_location, #source_location_string, #value, #value_in_class
Constructor Details
#initialize(sexp) ⇒ ModuleDef
Returns a new instance of ModuleDef.
1638 1639 1640 1641 1642 |
# File 'lib/yadriggy/ast.rb', line 1638 def initialize(sexp) @name = to_node(sexp[1]) # Const or ConstPathRef add_child(@name) initialize_body(has_tag?(sexp[2], :bodystmt)) end |
Instance Attribute Details
#body ⇒ Exprs|ASTnode (readonly)
Returns the body.
1632 1633 1634 |
# File 'lib/yadriggy/ast.rb', line 1632 def body @body end |
#name ⇒ Const|ConstPathRef (readonly)
Returns the module name.
1630 1631 1632 |
# File 'lib/yadriggy/ast.rb', line 1630 def name @name end |
#rescue ⇒ Rescue|nil (readonly)
Returns the rescue clause.
1634 1635 1636 |
# File 'lib/yadriggy/ast.rb', line 1634 def rescue @rescue end |
Class Method Details
.tag ⇒ Object
1636 |
# File 'lib/yadriggy/ast.rb', line 1636 def self.tag() :module end |
Instance Method Details
#accept(evaluator) ⇒ void
This method returns an undefined value.
A method for Visitor pattern.
1654 1655 1656 |
# File 'lib/yadriggy/ast.rb', line 1654 def accept(evaluator) evaluator.module_def(self) end |