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.
1642 1643 1644 1645 1646 |
# File 'lib/yadriggy/ast.rb', line 1642 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.
1636 1637 1638 |
# File 'lib/yadriggy/ast.rb', line 1636 def body @body end |
#name ⇒ Const|ConstPathRef (readonly)
Returns the module name.
1634 1635 1636 |
# File 'lib/yadriggy/ast.rb', line 1634 def name @name end |
#rescue ⇒ Rescue|nil (readonly)
Returns the rescue clause.
1638 1639 1640 |
# File 'lib/yadriggy/ast.rb', line 1638 def rescue @rescue end |
Class Method Details
.tag ⇒ Object
1640 |
# File 'lib/yadriggy/ast.rb', line 1640 def self.tag() :module end |
Instance Method Details
#accept(evaluator) ⇒ void
This method returns an undefined value.
A method for Visitor pattern.
1658 1659 1660 |
# File 'lib/yadriggy/ast.rb', line 1658 def accept(evaluator) evaluator.module_def(self) end |