Class: Postscript::Model::Operators::Transformations::Translate

Inherits:
Postscript::Model::Operator show all
Defined in:
lib/postscript/model/operators/transformations.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Postscript::Model::Operator

#accept, #operator?, register_as

Constructor Details

#initialize(tx:, ty:) ⇒ Translate

Returns a new instance of Translate.



10
11
12
13
14
# File 'lib/postscript/model/operators/transformations.rb', line 10

def initialize(tx:, ty:)
  @tx = tx
  @ty = ty
  freeze
end

Instance Attribute Details

#txObject (readonly)

Returns the value of attribute tx.



9
10
11
# File 'lib/postscript/model/operators/transformations.rb', line 9

def tx
  @tx
end

#tyObject (readonly)

Returns the value of attribute ty.



9
10
11
# File 'lib/postscript/model/operators/transformations.rb', line 9

def ty
  @ty
end

Class Method Details

.from_operands(stack) ⇒ Object



15
16
17
18
19
# File 'lib/postscript/model/operators/transformations.rb', line 15

def self.from_operands(stack)
  ty = stack.pop_number
  tx = stack.pop_number
  new(tx: tx, ty: ty)
end