dom_render 0.1.2 → 0.2.0

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: 8c04e282518b502976a0e6f945e021bb16fbf346
4
- data.tar.gz: 11423daa2b02a9416f31951ccd9221e23c2b3f06
3
+ metadata.gz: af7363d5b0fed8a3422d4c3c960c1a16a49431c7
4
+ data.tar.gz: be6d502ff08c532aeb655d75b58a967fd7d0757a
5
5
  SHA512:
6
- metadata.gz: b67c7b9cb2d417bcd963f21ae797ccee38d16a0b77b17089a14af431e5466e844323c548a71d986d7b98628b59d8b6697aa712048cac918b0abb6278e1b48fe0
7
- data.tar.gz: 6c3be0ebb3fccce0fdddc6edb65ea8c2e3dc1fa4547788d0f46faa20d2215521d117b109b5c0ab9e7f6bde95754b20c4ce4f209f9d8c987e7f46b7f791bf40ef
6
+ metadata.gz: b8ddf3c0349a5d0b7a6e4f4bcc9e60e9e402ee11f08cc06164a0e74798ace7d72405d3dd42f730d35a2fe3ae5b5503ebc38edfa6ec6682ce33c4c75e8606c356
7
+ data.tar.gz: 088482413e5831bd90bd2dfb2c9aa939f1b5286a6ddcaabe8b42d31412bf2a516e6a313b1ad183d16e8aefafd5928df3ce7853af8f09b694623056a23c3c5313
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/dom_render.rb CHANGED
@@ -15,7 +15,11 @@ class DomRender
15
15
 
16
16
  def render(x)
17
17
 
18
- r = method(x.name.to_sym).call(x)
18
+ style = fetch_style(x.attributes) if x.attributes.has_key? :style
19
+ args = [x]
20
+ args.concat([x.attributes, style])
21
+
22
+ r = method(x.name.to_sym).call(*args)
19
23
 
20
24
  if r.last.empty? then
21
25
  r[0..-2]
@@ -39,4 +43,16 @@ class DomRender
39
43
  end
40
44
 
41
45
  end
46
+
47
+ private
48
+
49
+ def fetch_style(attributes={})
50
+
51
+ attributes[:style].split(';').inject({}) do |r, x|
52
+ k, v = x.split(':',2)
53
+ r.merge(k.to_sym => v)
54
+ end
55
+
56
+ end
57
+
42
58
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dom_render
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file