Class: HexaPDF::Filter::FlateDecode::Pool
- Inherits:
-
Object
- Object
- HexaPDF::Filter::FlateDecode::Pool
- Defined in:
- lib/hexapdf/filter/flate_decode.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(&block) ⇒ Pool
constructor
Creates a new Zlib::Stream pool.
-
#next_available ⇒ Object
Returns the next available stream of the pool, already reset to its initial state.
Constructor Details
#initialize(&block) ⇒ Pool
Creates a new Zlib::Stream pool. A block must be given that returns a new Zlib::Stream instance.
52 53 54 55 |
# File 'lib/hexapdf/filter/flate_decode.rb', line 52 def initialize(&block) @creator = block @pool = [] end |
Instance Method Details
#next_available ⇒ Object
Returns the next available stream of the pool, already reset to its initial state.
58 59 60 |
# File 'lib/hexapdf/filter/flate_decode.rb', line 58 def next_available @pool.find(-> { e = @creator.call; @pool << e; e }, &:finished?).tap(&:reset) end |