blob: 1b8af997db0799c6799a277709e5952608657322 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
module Scale
class Path
include Node
attribute :d, String
def move_to(x:, y:)
command("M#{x} #{y}")
end
def line_to(x:, y:)
command("L #{x} #{y}")
end
def horizontal(n)
command("H #{n}")
end
def vertical(n)
command("V #{n}")
end
def close_path
command("Z")
end
def xml_tag
:path
end
private
def command(instructions)
if self.d.nil?
self.d = instructions
else
self.d = "#{self.d} #{instructions}"
end
end
end
end
|