Class: Xail::SampleFilter
- Inherits:
-
AbstractFilter
- Object
- AbstractFilter
- Xail::SampleFilter
- Defined in:
- lib/xail/filter.rb
Overview
Stream Mutators
Instance Method Summary collapse
-
#initialize(params) ⇒ SampleFilter
constructor
A new instance of SampleFilter.
- #streamLine(line) ⇒ Object
Methods inherited from AbstractFilter
Constructor Details
#initialize(params) ⇒ SampleFilter
Returns a new instance of SampleFilter.
219 220 221 222 |
# File 'lib/xail/filter.rb', line 219 def initialize(params) @rate = params.to_i @count = 0 end |
Instance Method Details
#streamLine(line) ⇒ Object
224 225 226 227 228 229 230 231 232 233 |
# File 'lib/xail/filter.rb', line 224 def streamLine(line) res = if @count % @rate == 0 line else "" end @count += 1 res end |