SassyExport 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/SassyExport.rb +23 -22
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87ea1c3c8713266858513866d0a792088031865c
4
- data.tar.gz: 587439cd8bf59d4d7cdd76db8e420b6a3cf28b57
3
+ metadata.gz: a3c3e18cfe073e85dddbfa3417f8a36612b4e5e0
4
+ data.tar.gz: feb2c593aed507edc440be127163718abd63344d
5
5
  SHA512:
6
- metadata.gz: 809e3e6944d4f209217fa2688e366b9f38901c8cdc0c8f5739452e7d37c32da46dce9deb7435116ed9f80f5f1b5c79f35840398719d4acd1776cdead23ca6e19
7
- data.tar.gz: 441e95501327dd5570ca4d0e68feadb9753bbdd8568e055e50325ebf2c489629dfe2d55921b5cabde488dd8ee1fdd487f5e6d4d523e3d2e554e6fafa9895c47a
6
+ metadata.gz: fe01b1754d5043e6a4f95ef5a80278ea4e2c8f2f667d4c60df64d11eeca45fd27741c6b0b86e732b65dba6a5bc2f6b99a974030b8c07f41b0096206a2372d100
7
+ data.tar.gz: 6978dee499e0212e8b2ece33509271ceabd4ed316e4f11354b6f0ac4a5ab1e5cc6cbc57f88f8344996b00776b9be952d4a9c9ff7bfcbb062b1a0bf00a74d8f00
@@ -7,7 +7,7 @@ Compass::Frameworks.register('SassyExport', :path => extension_path)
7
7
  # Version is a number. If a version contains alphas, it will be created as a prerelease version
8
8
  # Date is in the form of YYYY-MM-DD
9
9
  module SassyExport
10
- VERSION = "1.3.2"
10
+ VERSION = "1.3.3"
11
11
  DATE = "2014-07-24"
12
12
  end
13
13
 
@@ -37,24 +37,21 @@ module Sass::Script::Functions
37
37
  def recurs_to_a(array)
38
38
  if array.is_a?(Array)
39
39
  array.map do | l |
40
- if l.is_a?(Sass::Script::Value::Map)
40
+ case l
41
+ when Sass::Script::Value::Map
41
42
  # if map, recurse to hash
42
43
  l = recurs_to_h(l)
43
- elsif l.is_a?(Sass::Script::Value::List)
44
+ when Sass::Script::Value::List
44
45
  # if list, recurse to array
45
46
  l = recurs_to_a(l)
46
- elsif l.is_a?(Sass::Script::Value::Bool)
47
+ when Sass::Script::Value::Bool
47
48
  # convert to bool
48
49
  l = l.to_bool
49
- elsif l.is_a?(Sass::Script::Value::Number)
50
+ when Sass::Script::Value::Number
50
51
  # if it's a unitless number, convert to ruby val
51
- if l.unitless?
52
- l = l.value
53
52
  # else convert to string
54
- else
55
- l = u(l)
56
- end
57
- elsif l.is_a?(Sass::Script::Value::Color)
53
+ l.unitless? ? l = l.value : l = u(l)
54
+ when Sass::Script::Value::Color
58
55
  # get hex/rgba value for color
59
56
  l = l.inspect
60
57
  else
@@ -72,21 +69,25 @@ module Sass::Script::Functions
72
69
  def recurs_to_h(hash)
73
70
  if hash.is_a?(Hash)
74
71
  hash.inject({}) do | h, (k, v) |
75
- if v.is_a?(Sass::Script::Value::Map)
72
+ case v
73
+ when Sass::Script::Value::Map
74
+ # if map, recurse to hash
76
75
  h[u(k)] = recurs_to_h(v)
77
- elsif v.is_a?(Sass::Script::Value::List)
76
+ when Sass::Script::Value::List
77
+ # if list, recurse to array
78
78
  h[u(k)] = recurs_to_a(v)
79
- elsif v.is_a?(Sass::Script::Value::Bool)
79
+ when Sass::Script::Value::Bool
80
+ # convert to bool
80
81
  h[u(k)] = v.to_bool
81
- elsif v.is_a?(Sass::Script::Value::Number)
82
- if v.unitless?
83
- h[u(k)] = v.value
84
- else
85
- h[u(k)] = u(v)
86
- end
87
- elsif v.is_a?(Sass::Script::Value::Color)
82
+ when Sass::Script::Value::Number
83
+ # if it's a unitless number, convert to ruby val
84
+ # else convert to string
85
+ v.unitless? ? h[u(k)] = v.value : h[u(k)] = u(v)
86
+ when Sass::Script::Value::Color
87
+ # get hex/rgba value for color
88
88
  h[u(k)] = v.inspect
89
89
  else
90
+ # convert to string
90
91
  h[u(k)] = u(v)
91
92
  end
92
93
  h
@@ -143,7 +144,7 @@ module Sass::Script::Functions
143
144
  pretty ? json = JSON.pretty_generate(hash) : json = JSON.generate(hash)
144
145
 
145
146
  # if we're turning it straight to js put a variable name in front
146
- ext == '.js' ? json = "var " + filename + " = " + json : json = json
147
+ json = "var " + filename + " = " + json if ext == '.js'
147
148
 
148
149
  # define flags
149
150
  flag = 'w'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SassyExport
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ezekiel Gabrielse