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.
7 8 9 10 |
# File 'lib/xamplr/visitors.rb', line 7 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.
5 6 7 |
# File 'lib/xamplr/visitors.rb', line 5 def count @count end |
Instance Method Details
#before_visit(xampl) ⇒ Object
12 13 14 |
# File 'lib/xamplr/visitors.rb', line 12 def before_visit(xampl) @count += 1 end |