Class: HexaPDF::Task::Optimize::SerializationProcessor
- Inherits:
-
Object
- Object
- HexaPDF::Task::Optimize::SerializationProcessor
- Defined in:
- lib/hexapdf/task/optimize.rb
Overview
This processor is used when compressing pages.
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
:nodoc:.
-
#used_references ⇒ Object
readonly
Contains all found references.
Instance Method Summary collapse
-
#initialize(&error_block) ⇒ SerializationProcessor
constructor
:nodoc:.
-
#process(op, operands) ⇒ Object
:nodoc:.
Constructor Details
#initialize(&error_block) ⇒ SerializationProcessor
:nodoc:
280 281 282 283 284 285 |
# File 'lib/hexapdf/task/optimize.rb', line 280 def initialize(&error_block) #:nodoc: @result = ''.b @serializer = HexaPDF::Serializer.new @used_references = [] @error_block = error_block end |
Instance Attribute Details
#result ⇒ Object (readonly)
:nodoc:
275 276 277 |
# File 'lib/hexapdf/task/optimize.rb', line 275 def result @result end |
#used_references ⇒ Object (readonly)
Contains all found references
278 279 280 |
# File 'lib/hexapdf/task/optimize.rb', line 278 def used_references @used_references end |
Instance Method Details
#process(op, operands) ⇒ Object
:nodoc:
287 288 289 290 291 292 293 294 |
# File 'lib/hexapdf/task/optimize.rb', line 287 def process(op, operands) #:nodoc: @result << HexaPDF::Content::Operator::DEFAULT_OPERATORS[op]. serialize(@serializer, *operands) @used_references << operands[0] if op == :Do rescue StandardError => e @error_block.call("Invalid content stream operation found: " \ "#{op}#{operands.inspect} (#{e.})") end |