Class: Pegarus::Variable

Inherits:
Pattern show all
Defined in:
lib/pegarus/ast/variable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Pattern

#*, #+, #+@, #-, #-@, #/, engine, #graph, #match, select_engine, #visit

Constructor Details

#initialize(name, pattern = nil) ⇒ Variable

Returns a new instance of Variable.



10
11
12
13
# File 'lib/pegarus/ast/variable.rb', line 10

def initialize(name, pattern=nil)
  @name = name.to_sym
  @pattern = Pegarus.pattern pattern
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/pegarus/ast/variable.rb', line 8

def name
  @name
end

#patternObject

Returns the value of attribute pattern.



8
9
10
# File 'lib/pegarus/ast/variable.rb', line 8

def pattern
  @pattern
end