Class: Wukong::Processor::Tail
- Inherits:
-
Filter
- Object
- Hanuman::Stage
- Wukong::Processor
- Filter
- Wukong::Processor::Tail
- Defined in:
- lib/wukong/widget/filters.rb
Overview
Skip the first n
records.
Works slightly differently than the UNIX tail
command which
prints the last n
records. This notion is less useful in a
streaming context, so think of this filter as the equivalent of
tail -n+
.
Constant Summary
Constants inherited from Wukong::Processor
Instance Attribute Summary collapse
-
#count ⇒ Object
The current record count.
Attributes included from Hanuman::StageInstanceMethods
Instance Method Summary collapse
-
#select?(record) ⇒ true, false
Select a record only if we've already skipped the first
n
records. -
#setup ⇒ Object
Initializes the record count to zero.
Methods inherited from Filter
Methods inherited from Wukong::Processor
configure, description, #finalize, #perform_action, #process, #receive_action, #stop
Methods included from Logging
Methods inherited from Hanuman::Stage
Methods included from Hanuman::StageClassMethods
#builder, #label, #register, #set_builder
Methods included from Hanuman::StageInstanceMethods
#add_link, #linkable_name, #root
Instance Attribute Details
#count ⇒ Object
The current record count
416 417 418 |
# File 'lib/wukong/widget/filters.rb', line 416 def count @count end |
Instance Method Details
#select?(record) ⇒ true, false
Select a record only if we've already skipped the first n
records.
428 429 430 431 432 |
# File 'lib/wukong/widget/filters.rb', line 428 def select?(record) keep = (@count >= n) @count += 1 keep end |
#setup ⇒ Object
Initializes the record count to zero.
419 420 421 |
# File 'lib/wukong/widget/filters.rb', line 419 def setup self.count = 0 end |