Class: Postsvg::Model::Operators::Path::Lineto

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:) ⇒ Lineto

Returns a new instance of Lineto.



44
45
46
47
48
# File 'lib/postsvg/model/operators/path.rb', line 44

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

Instance Attribute Details

#xObject (readonly)

Returns the value of attribute x.



43
44
45
# File 'lib/postsvg/model/operators/path.rb', line 43

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



43
44
45
# File 'lib/postsvg/model/operators/path.rb', line 43

def y
  @y
end

Class Method Details

.from_operands(stack) ⇒ Object



49
50
51
52
53
# File 'lib/postsvg/model/operators/path.rb', line 49

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