Class: PLang::Parser::Node
- Inherits:
-
Object
- Object
- PLang::Parser::Node
- Defined in:
- lib/parser/node.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, params) ⇒ Node
constructor
A new instance of Node.
- #inspect ⇒ Object
- #method_missing(name, *args) ⇒ Object
Constructor Details
#initialize(type, params) ⇒ Node
Returns a new instance of Node.
5 6 7 8 |
# File 'lib/parser/node.rb', line 5 def initialize(type, params) @type = type @params = params end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
10 11 12 |
# File 'lib/parser/node.rb', line 10 def method_missing(name, *args) return @params[name] end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/parser/node.rb', line 4 def type @type end |
Instance Method Details
#inspect ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/parser/node.rb', line 14 def inspect ret = [@type] @params.each do |id, value| ret << value end ret end |