dom_render 0.2.2 → 0.2.3

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: 5b713831ebed03a5d5cc08717d1eb090202e1e28
4
- data.tar.gz: 13311de83a98db2d1cc45b2d342249ac1bc08a3c
3
+ metadata.gz: 7b47dc68cc997f50c128a0089c1cf9a242f666b6
4
+ data.tar.gz: 044f66c0048d94a9f036307781358532fa155bef
5
5
  SHA512:
6
- metadata.gz: 37e6af144cd917069d1ad614ef9daae8a34904bca58ff58bff751422be7c8c118d2953ea425e6eb58e5edac0fe3a029bd4dcc8a9a66effddbd84e74298618505
7
- data.tar.gz: 1703e61ecd235aaba17c6ae22212dcbe31b234cff7d8b6839422a0d1cfee25c2026d8d4c301fb20f5fc0d604063a932c2524505aa27ecccdff4a330d3ec6ad53
6
+ metadata.gz: 257f404542e8bb05dfdd5e19390064f09f51a794bcd4b223cb5b4cedfc6f501a0047e95d6859fa30e55cb9698b84665c480416528aba761e8e14af0da34e458a
7
+ data.tar.gz: 0b63f32ee3c28b86c790ae15eba6d1dcb794a5ac2c7dd9101d94e245232477c112b33d1e00a46d9bc0f4466c00547d1d2e0908f720a4ca663fc1a6d71bb985fc
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/dom_render.rb CHANGED
@@ -62,4 +62,22 @@ class DomRender
62
62
 
63
63
  end
64
64
 
65
- end
65
+ # expands a CSS shorthand for a margin or padding property
66
+ # e.g. "1em 1.5em" #=> ['1em','1.5em','1em','1.5em']
67
+ #
68
+ def expand_shorthand(s)
69
+
70
+ a = s.scan(/\d+(?:\.\d+)?\s*(?:em|px)?/)
71
+
72
+ case a.length
73
+ when 1 then [a[0]] * 4
74
+ when 2 then [a[0],a[-1],a[0],a[-1]]
75
+ when 4 then a
76
+ else
77
+ (a + [0,0,0,0]).take 4
78
+ end
79
+
80
+ end
81
+
82
+
83
+ end
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.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  ipCgMpSHSTGoxQ/dI853bcb+vPkAqS69GEcZgtvAmCQs5E4KC1seYLuP3qtuatL9
32
32
  dbkCMOVMy0htMQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-11-24 00:00:00.000000000 Z
34
+ date: 2015-11-25 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rexle
metadata.gz.sig CHANGED
Binary file