Class: PLang::Parser::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/parser/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/parser/node.rb', line 4

def type
  @type
end

Instance Method Details

#inspectObject



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