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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d6115fe65ecf261d93876cdb92cdfd2d4df4d7f
4
- data.tar.gz: 5c0f8fd33ece472364359b30a798bf24cc9483bd
3
+ metadata.gz: 2fd14fc46ed3e7bf33d58024aa50862943b47a3a
4
+ data.tar.gz: 120d90ae2b2626b2e6b59eab6ec52eff50e8273f
5
5
  SHA512:
6
- metadata.gz: ad1d55fa76f6aa1a87450f55ec7ebf05a31661ede773a93ef8cb2050e780e01807a096a7a5569c352a28a4413d27d6a3fcc286bde33d7389978739f759d9f6e4
7
- data.tar.gz: e77ff72a2a1104b1b2b56a46e3fe9139fdb9619083217044f6c00341325286457b082b295d66d0625f8bcac6437d0992262e20cae35826d476117427c122227c
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 Svgle < Rexle
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 << :id
57
+ a.concat %i(id style)
20
58
 
21
59
  a.each do |attribute|
22
60
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svgle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file