Class: Pacer::Pipes::BlockFilterPipe
- Inherits:
-
AbstractPipe
- Object
- AbstractPipe
- Pacer::Pipes::BlockFilterPipe
- Defined in:
- lib/pacer/pipe/block_filter_pipe.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#invert ⇒ Object
readonly
Returns the value of attribute invert.
Instance Method Summary collapse
-
#initialize(back, block, invert = false) ⇒ BlockFilterPipe
constructor
A new instance of BlockFilterPipe.
- #processNextStart ⇒ Object
Constructor Details
#initialize(back, block, invert = false) ⇒ BlockFilterPipe
Returns a new instance of BlockFilterPipe.
7 8 9 10 11 |
# File 'lib/pacer/pipe/block_filter_pipe.rb', line 7 def initialize(back, block, invert = false) super() @invert = invert @block = Pacer::Wrappers::WrappingPipeFunction.new back, block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
5 6 7 |
# File 'lib/pacer/pipe/block_filter_pipe.rb', line 5 def block @block end |
#invert ⇒ Object (readonly)
Returns the value of attribute invert.
5 6 7 |
# File 'lib/pacer/pipe/block_filter_pipe.rb', line 5 def invert @invert end |
Instance Method Details
#processNextStart ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/pacer/pipe/block_filter_pipe.rb', line 13 def processNextStart() while raw_element = starts.next ok = block.call raw_element ok = !ok if invert return raw_element if ok end raise EmptyPipe.instance end |