class HexaPDF::Content::Operator::BaseOperator
A base class for operator implementations.
A default implementation for the serialize
method is provided. However, for performance reasons each operator should provide a custom serialize
method.
Attributes
name[R]
The name of the operator.
Public Class Methods
new(name)
click to toggle source
Initialize the operator called name
.
# File lib/hexapdf/content/operator.rb, line 91 def initialize(name) @name = name.freeze end
Public Instance Methods
invoke(*)
click to toggle source
Invokes the operator so that it performs its job.
This base version does nothing!
# File lib/hexapdf/content/operator.rb, line 98 def invoke(*) end
serialize(serializer, *operands)
click to toggle source
Returns the string representation of the operator, i.e.
operand1 operand2 operand3 name
# File lib/hexapdf/content/operator.rb, line 104 def serialize(serializer, *operands) result = ''.b operands.each do |operand| result << serializer.serialize(operand) << " " end result << name << "\n" end