Class: Parser::AST::ArgumentsNode
- Inherits:
-
Object
- Object
- Parser::AST::ArgumentsNode
- Defined in:
- lib/synvert/core/node_ext.rb
Overview
ArgumentsNode allows to handle all args as one node or handle all args as an array.
Instance Method Summary collapse
-
#initialize(node) ⇒ ArgumentsNode
constructor
Initialize.
-
#method_missing(meth, *args, &block) ⇒ Object
If args node responds method itself, call method on args node.
Constructor Details
#initialize(node) ⇒ ArgumentsNode
Initialize
7 8 9 |
# File 'lib/synvert/core/node_ext.rb', line 7 def initialize(node) @node = node end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
If args node responds method itself, call method on args node. If args children (array) responds method, call method on args children. Otherwise raise method missing error.
14 15 16 17 18 19 20 21 22 |
# File 'lib/synvert/core/node_ext.rb', line 14 def method_missing(meth, *args, &block) if @node.respond_to?(meth) @node.send meth, *args, &block elsif @node.children.respond_to?(meth) @node.children.send meth, *args, &block else super end end |