Class: Postsvg::Model::Operators::Path::Moveto

Inherits:
Postsvg::Model::Operator show all
Defined in:
lib/postsvg/model/operators/path.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Postsvg::Model::Operator

#accept, #operator?, register_as

Constructor Details

#initialize(x:, y:) ⇒ Moveto

Returns a new instance of Moveto.



14
15
16
17
18
# File 'lib/postsvg/model/operators/path.rb', line 14

def initialize(x:, y:)
  @x = x
  @y = y
  freeze
end

Instance Attribute Details

#xObject (readonly)

Returns the value of attribute x.



13
14
15
# File 'lib/postsvg/model/operators/path.rb', line 13

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



13
14
15
# File 'lib/postsvg/model/operators/path.rb', line 13

def y
  @y
end

Class Method Details

.from_operands(stack) ⇒ Object



19
20
21
22
23
# File 'lib/postsvg/model/operators/path.rb', line 19

def self.from_operands(stack)
  y = stack.pop_number
  x = stack.pop_number
  new(x: x, y: y)
end