svgle 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -1
- data/lib/svgle.rb +32 -4
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69eca805f2560b1d9b85b03678c7f9046a534440
|
4
|
+
data.tar.gz: a4b5d64859f9b143fe5a943cfb55da209f3942ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db8d0fc540d8572e7a856cf2f0d417888dd40c24e2809c7f60573db8b5d91798ebff1cdabbdb99631530b7ee975d4fde74547627209eb388e1d6ae8b98b326ad
|
7
|
+
data.tar.gz: 7ce7fc827cd0b04045b7ef0bef3f41999155b969ab584b2a8562e8be4ef948b74a6e891182ed841eb412e9ca7e995bb15206fe19e6a6c8447a0d884fcd39d4e3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
c���+ͬ��x���aTD��r��p��|�F9C�q��Uu�A���+2\���Ѓ�f�6)e�C}��_���)z'�~�8T~��X�g�t����쾨�³��4�
|
2
|
+
Z/_��!��Ɇ�ږ�ޱ����Nwom9�s�pRQ���}W��R
|
data/lib/svgle.rb
CHANGED
@@ -24,13 +24,23 @@ class Style < Hash
|
|
24
24
|
|
25
25
|
super(k,v)
|
26
26
|
@parent[:style] = self.map{|x| x.join(':') }.join(';')
|
27
|
+
@parent.callback.refresh
|
27
28
|
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
31
32
|
class Attributes
|
32
33
|
|
33
|
-
|
34
|
+
attr_reader :callback
|
35
|
+
|
36
|
+
def initialize(parent: nil)
|
37
|
+
@callback = parent
|
38
|
+
end
|
39
|
+
|
40
|
+
def style(parent=nil)
|
41
|
+
|
42
|
+
@callback ||= parent
|
43
|
+
|
34
44
|
if @style.nil? then
|
35
45
|
|
36
46
|
h = self[:style].split(';').inject({}) do |r, x|
|
@@ -52,6 +62,9 @@ class Svgle < Rexle
|
|
52
62
|
|
53
63
|
class Element < Rexle::Element
|
54
64
|
|
65
|
+
def initialize(name=nil, value: nil, attributes: Attributes.new(parent: self), rexle: nil)
|
66
|
+
super(name, value: value, attributes: attributes, rexle: rexle)
|
67
|
+
end
|
55
68
|
|
56
69
|
def self.attr2_accessor(*a)
|
57
70
|
|
@@ -67,6 +80,8 @@ class Svgle < Rexle
|
|
67
80
|
|
68
81
|
define_method (attribute.to_s + '=').to_sym do |val|
|
69
82
|
attributes[attribute] = val
|
83
|
+
@rexle.refresh
|
84
|
+
val
|
70
85
|
end
|
71
86
|
|
72
87
|
end
|
@@ -74,7 +89,7 @@ class Svgle < Rexle
|
|
74
89
|
end
|
75
90
|
|
76
91
|
def style()
|
77
|
-
attributes.style
|
92
|
+
attributes.style(@rexle)
|
78
93
|
end
|
79
94
|
end
|
80
95
|
|
@@ -85,8 +100,12 @@ class Svgle < Rexle
|
|
85
100
|
end
|
86
101
|
|
87
102
|
class Circle < Element
|
88
|
-
attr2_accessor *%i(cx cy r
|
89
|
-
end
|
103
|
+
attr2_accessor *%i(cx cy r stroke stroke-width)
|
104
|
+
end
|
105
|
+
|
106
|
+
class Ellipse < Element
|
107
|
+
attr2_accessor *%i(cx cy rx ry)
|
108
|
+
end
|
90
109
|
|
91
110
|
class G < Element
|
92
111
|
attr2_accessor *%i(fill opacity)
|
@@ -121,6 +140,15 @@ class Svgle < Rexle
|
|
121
140
|
end
|
122
141
|
|
123
142
|
|
143
|
+
def initialize(x=nil,callback: nil)
|
144
|
+
super x
|
145
|
+
@callback = callback
|
146
|
+
end
|
147
|
+
|
148
|
+
def refresh()
|
149
|
+
@callback.refresh if @callback
|
150
|
+
end
|
151
|
+
|
124
152
|
def scan_element(name, attributes=nil, *children)
|
125
153
|
|
126
154
|
return Rexle::CData.new(children.first) if name == '!['
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|