Class: HexaPDF::TestUtils::OperatorRecorder

Inherits:
Content::Processor show all
Defined in:
lib/hexapdf/test_utils.rb

Overview

Can be used to to record operators parsed from content streams.

Constant Summary

Constants inherited from Content::Processor

Content::Processor::OPERATOR_MESSAGE_NAME_MAP

Instance Attribute Summary collapse

Attributes inherited from Content::Processor

#graphics_object, #graphics_state, #operators, #resources

Instance Method Summary collapse

Methods inherited from Content::Processor

#process

Constructor Details

#initializeOperatorRecorder

Returns a new instance of OperatorRecorder.



51
52
53
54
55
# File 'lib/hexapdf/test_utils.rb', line 51

def initialize
  super
  operators.clear
  @recorded_ops = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(msg, *params) ⇒ Object



61
62
63
# File 'lib/hexapdf/test_utils.rb', line 61

def method_missing(msg, *params)
  @recorded_ops << (params.empty? ? [msg] : [msg, params])
end

Instance Attribute Details

#recorded_opsObject (readonly)

Returns the value of attribute recorded_ops.



49
50
51
# File 'lib/hexapdf/test_utils.rb', line 49

def recorded_ops
  @recorded_ops
end

Instance Method Details

#respond_to_missing?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/hexapdf/test_utils.rb', line 57

def respond_to_missing?(*)
  true
end