Class: Pacer::Filter::LimitSectionFilter::LimitSectionPipe
- Inherits:
-
Pipes::RubyPipe
- Object
- AbstractPipe
- Pipes::RubyPipe
- Pacer::Filter::LimitSectionFilter::LimitSectionPipe
- Defined in:
- lib/pacer/filter/limit_section_filter.rb
Instance Attribute Summary collapse
-
#hits ⇒ Object
Returns the value of attribute hits.
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#route ⇒ Object
readonly
Returns the value of attribute route.
-
#section ⇒ Object
readonly
Returns the value of attribute section.
Attributes inherited from Pipes::RubyPipe
Instance Method Summary collapse
- #after_element ⇒ Object
-
#initialize(route, section, max) ⇒ LimitSectionPipe
constructor
A new instance of LimitSectionPipe.
- #processNextStart ⇒ Object
- #reset ⇒ Object
Methods inherited from Pipes::RubyPipe
Constructor Details
#initialize(route, section, max) ⇒ LimitSectionPipe
Returns a new instance of LimitSectionPipe.
30 31 32 33 34 35 36 37 |
# File 'lib/pacer/filter/limit_section_filter.rb', line 30 def initialize(route, section, max) super() @hits = 0 @max = max @section = section @route = route section.visitor = self if section end |
Instance Attribute Details
#hits ⇒ Object
Returns the value of attribute hits.
27 28 29 |
# File 'lib/pacer/filter/limit_section_filter.rb', line 27 def hits @hits end |
#max ⇒ Object (readonly)
Returns the value of attribute max.
26 27 28 |
# File 'lib/pacer/filter/limit_section_filter.rb', line 26 def max @max end |
#route ⇒ Object (readonly)
Returns the value of attribute route.
26 27 28 |
# File 'lib/pacer/filter/limit_section_filter.rb', line 26 def route @route end |
#section ⇒ Object (readonly)
Returns the value of attribute section.
26 27 28 |
# File 'lib/pacer/filter/limit_section_filter.rb', line 26 def section @section end |
Instance Method Details
#after_element ⇒ Object
47 48 49 |
# File 'lib/pacer/filter/limit_section_filter.rb', line 47 def after_element self.hits = 0 end |
#processNextStart ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/pacer/filter/limit_section_filter.rb', line 39 def processNextStart while hits == max starts.next end self.hits += 1 starts.next end |
#reset ⇒ Object
51 52 53 |
# File 'lib/pacer/filter/limit_section_filter.rb', line 51 def reset self.hits = 0 end |