Class: Xampl::CountingVisitor
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
Attributes inherited from Visitor
#done, #no_children, #no_siblings
Instance Method Summary collapse
- #before_visit(xampl) ⇒ Object
-
#initialize ⇒ CountingVisitor
constructor
A new instance of CountingVisitor.
Methods inherited from Visitor
#after_visit, #around_visit, #cycle, #method_missing, #reset, #revisit, #short_circuit, #start, #substitute_in_visit, #visit_string
Constructor Details
#initialize ⇒ CountingVisitor
Returns a new instance of CountingVisitor.
30 31 32 33 |
# File 'lib/xamplr/visitors.rb', line 30 def initialize super @count = 0 end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Xampl::Visitor
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
28 29 30 |
# File 'lib/xamplr/visitors.rb', line 28 def count @count end |
Instance Method Details
#before_visit(xampl) ⇒ Object
35 36 37 |
# File 'lib/xamplr/visitors.rb', line 35 def before_visit(xampl) @count += 1 end |