svgle 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/svgle.rb +40 -2
- 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: 2fd14fc46ed3e7bf33d58024aa50862943b47a3a
|
4
|
+
data.tar.gz: 120d90ae2b2626b2e6b59eab6ec52eff50e8273f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d18aa93886242f3fab912510d44cfac572ded412bc1d9205947e01006254b24fadf052d0bfb28b520d0a9c5a30fc95fb041c9436dc9280c0eadd8f6636fbd18a
|
7
|
+
data.tar.gz: 69facfdf3058d1492ffed3033346a72de326f9ff286875f4024e13a7c5ec7ce27a79df020a993ba831c45c106185e5b754de3cc4b15d90bd67e9bf832eba9354
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/svgle.rb
CHANGED
@@ -10,13 +10,51 @@ require 'rexle'
|
|
10
10
|
# * http://www.w3schools.com/svg/svg_reference.asp
|
11
11
|
|
12
12
|
|
13
|
-
class
|
13
|
+
class Style < Hash
|
14
|
+
|
15
|
+
def initialize(parent, h)
|
16
|
+
@parent = parent
|
17
|
+
|
18
|
+
super().merge! h
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
def []=(k,v)
|
23
|
+
|
24
|
+
super(k,v)
|
25
|
+
@parent[:style] = self.map{|x| x.join(':') }.join(';')
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class Attributes
|
31
|
+
|
32
|
+
def style
|
33
|
+
if @style.nil? then
|
14
34
|
|
35
|
+
h = self[:style].split(';').inject({}) do |r, x|
|
36
|
+
k, v = x.split(':',2)
|
37
|
+
r.merge(k.to_sym => v)
|
38
|
+
end
|
39
|
+
|
40
|
+
@style = Style.new(self, h)
|
41
|
+
|
42
|
+
h
|
43
|
+
end
|
44
|
+
@style
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
class Svgle < Rexle
|
51
|
+
|
15
52
|
class Element < Rexle::Element
|
53
|
+
|
16
54
|
|
17
55
|
def self.attr2_accessor(*a)
|
18
56
|
|
19
|
-
a
|
57
|
+
a.concat %i(id style)
|
20
58
|
|
21
59
|
a.each do |attribute|
|
22
60
|
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|