Class: HexaPDF::FiberWithLength
- Inherits:
-
Fiber
- Object
- Fiber
- HexaPDF::FiberWithLength
- Defined in:
- lib/hexapdf/filter.rb
Overview
This special Fiber class should be used when the total length of the data yielded by the fiber is known beforehand. HexaPDF uses this information to avoid unnecessary memory usage.
Instance Attribute Summary collapse
-
#length ⇒ Object
readonly
The total length of the data that will be yielded by this fiber.
Instance Method Summary collapse
-
#initialize(length, &block) ⇒ FiberWithLength
constructor
Initializes the Fiber and sets the
length
.
Constructor Details
#initialize(length, &block) ⇒ FiberWithLength
Initializes the Fiber and sets the length
.
A length
of nil
is equal to -1.
53 54 55 56 |
# File 'lib/hexapdf/filter.rb', line 53 def initialize(length, &block) super(&block) @length = length || -1 end |
Instance Attribute Details
#length ⇒ Object (readonly)
The total length of the data that will be yielded by this fiber. If the return value is negative the total length is not known.
48 49 50 |
# File 'lib/hexapdf/filter.rb', line 48 def length @length end |