sassy_hash 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/sassy_hash.rb +5 -5
- data/spec/sass_hash_spec.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDk3ODY3MjU0ZjMwOWVkZTQ4NDlhMGNkNzRmM2FhM2JkNzE2ZjdiNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTE1MDYyNmI4NGY3NmUyOWJjY2YwZGIzODJkYTY1NjhhYzJjYjk5OA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDY3YWI5ZTRhYzUyNjdkNDg5OThkZmNmODg0MGNhZmRhZDJiMTdkZmJhNjM5
|
10
|
+
MjRmMDFhZDhjOWMyMzI3NDJlZTgwZGY0OGI3NDY2MzZjZjI4ZDdmNWRlYzBi
|
11
|
+
ODBkNTQ0ZDFhZWEwZmQ3MGZmNjkzYWQ1NDBmODVmMzYxZTUyM2Q=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzUyYzU0ZWU3ZDNjOTlmN2YwY2MyN2MyMjllYTZlMmFlMzIyYWJjZjE4YTAy
|
14
|
+
OTgzYTZhNzQ2MjEwMDgwZDc3ZDQyYzgxNTAxZmIzMDRiMTBlZGE0ZTA2MGI1
|
15
|
+
MzY1MTllMGIxYzk0OTMwNmVkNGJlMTdjYjhjNzcyYjM1N2Y5YjM=
|
data/lib/sassy_hash.rb
CHANGED
@@ -2,7 +2,7 @@ require 'sass'
|
|
2
2
|
require 'sass/scss/rx'
|
3
3
|
class SassyHashException < Exception; end
|
4
4
|
class SassyHash < Hash
|
5
|
-
VERSION = "0.0.
|
5
|
+
VERSION = "0.0.5"
|
6
6
|
VALID_UNIT = %r{(?<unit>#{::Sass::SCSS::RX::NMSTART}#{::Sass::SCSS::RX::NMCHAR}|%*)}
|
7
7
|
VALID_NUMBER = %r{(?<number>#{::Sass::SCSS::RX::NUM})#{VALID_UNIT}}
|
8
8
|
|
@@ -39,14 +39,14 @@ class SassyHash < Hash
|
|
39
39
|
when Symbol
|
40
40
|
return ::Sass::Script::Value::String.new(value.to_s)
|
41
41
|
when String
|
42
|
-
#number
|
43
|
-
if matches = value.match(VALID_NUMBER)
|
44
|
-
return ::Sass::Script::Value::Number.new(matches[:number], matches[:unit])
|
45
|
-
end
|
46
42
|
# color
|
47
43
|
if value =~ ::Sass::SCSS::RX::HEXCOLOR
|
48
44
|
return ::Sass::Script::Value::Color.from_hex(value)
|
49
45
|
end
|
46
|
+
#number
|
47
|
+
if matches = value.match(VALID_NUMBER)
|
48
|
+
return ::Sass::Script::Value::Number.new(matches[:number], matches[:unit])
|
49
|
+
end
|
50
50
|
#string
|
51
51
|
return ::Sass::Script::Value::String.new(value)
|
52
52
|
when Array
|
data/spec/sass_hash_spec.rb
CHANGED
@@ -62,6 +62,7 @@ describe SassyHash do
|
|
62
62
|
1.0 => ::Sass::Script::Value::Number,
|
63
63
|
"1.0px" => ::Sass::Script::Value::Number,
|
64
64
|
'1px' => ::Sass::Script::Value::Number,
|
65
|
+
'120px' => ::Sass::Script::Value::Number,
|
65
66
|
:foo => ::Sass::Script::Value::String,
|
66
67
|
true => ::Sass::Script::Value::Bool,
|
67
68
|
false => ::Sass::Script::Value::Bool
|