Class: SaxStream::Collectors::BlockCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/sax_stream/collectors/block_collector.rb

Overview

Initialise this collector with a block that handles one argument. This collector will yield each mapped object it collects immediately to the block. It will not keep a record of the objects.

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ BlockCollector

Returns a new instance of BlockCollector.



6
7
8
# File 'lib/sax_stream/collectors/block_collector.rb', line 6

def initialize(&block)
  @block = block
end

Instance Method Details

#<<(value) ⇒ Object



10
11
12
# File 'lib/sax_stream/collectors/block_collector.rb', line 10

def <<(value)
  @block.call(value)
end