sassy_hash 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d51fbe4d6eb85ed5676d8edaa4598a08b58d98be
4
- data.tar.gz: 811175e552908c7e5502e87576754c0a1481a6d8
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YTU0M2ZhYzc5ZWIzYWE5ZTJjZTBkYzVmM2FkYzdlMTViMzlhNzllZg==
5
+ data.tar.gz: !binary |-
6
+ NTI4N2Y4OTBmOTRjYjI1ZWY4OTBmOWRjMTI5YTEwMjJkNzI5NmEwMw==
5
7
  SHA512:
6
- metadata.gz: b7ff3bdac544b251cee18873077fd4bf2d8170e1b604e014c02f79af430e2480be56d7229b0a9172c6cc90ff6b6a4cf67fab9e0b9c19ee89d09d8388081a150c
7
- data.tar.gz: 2680c8a41a5d6e071c41d61bb73617cea05ebf30d6aa1d939b908a26e09c51618bab0c1c42881e90709da999a6d88a07e1f084bba92256d7c296aed7f492b608
8
+ metadata.gz: !binary |-
9
+ YzZmODUzMGMxMTNmY2M2ZjFmNDQ2OWQzNWU2NDYyNWQ0ZTI3OGYwY2M0MTFj
10
+ MjIwMzAxMzVkMGRmZmQyYjA5MDdlZmU0Y2UyZWM4MTY3NmNlOTgyYWZkYTQ3
11
+ MWE0MjA1ZjI1MDQ4NWZhZTBiMWQ4NTNlMmU1ODJmMTdkM2VhMjY=
12
+ data.tar.gz: !binary |-
13
+ MjlhMTkxMDk1ZmEwNDI1ZTJiOWUxMjdmN2Q3ZWVmZjk4MWQzNjE4NjdiNTFj
14
+ YTgxYmNjYjZlZTE4M2IxYjBjOTg0N2EzYzc2NzkzZmYwNmQyZDdhZmM2NGNi
15
+ YjIyZGRhN2IyMTYzNjA3M2JlNjNhMjlhODdlNmJjMDdkNjJiZGI=
data/lib/sassy_hash.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  require 'sass'
2
+ require 'sass/scss/rx'
2
3
  class SassyHashException < Exception; end
3
4
  class SassyHash < Hash
4
- VERSION = "0.0.3"
5
+ VERSION = "0.0.4"
5
6
  VALID_UNIT = %r{(?<unit>#{::Sass::SCSS::RX::NMSTART}#{::Sass::SCSS::RX::NMCHAR}|%*)}
6
7
  VALID_NUMBER = %r{(?<number>#{::Sass::SCSS::RX::NUM})#{VALID_UNIT}}
7
8
 
@@ -38,12 +39,18 @@ class SassyHash < Hash
38
39
  when Symbol
39
40
  return ::Sass::Script::Value::String.new(value.to_s)
40
41
  when String
42
+ #number
41
43
  if matches = value.match(VALID_NUMBER)
42
44
  return ::Sass::Script::Value::Number.new(matches[:number], matches[:unit])
43
45
  end
46
+ # color
47
+ if value =~ ::Sass::SCSS::RX::HEXCOLOR
48
+ return ::Sass::Script::Value::Color.from_hex(value)
49
+ end
50
+ #string
44
51
  return ::Sass::Script::Value::String.new(value)
45
52
  when Array
46
- return ::Sass::Script::Value::List.new(array_to_list(value), :sapce)
53
+ return ::Sass::Script::Value::List.new(value.map {|v| sass_convert_value(v) }, :sapce)
47
54
  when Hash
48
55
  return ::Sass::Script::Value::Map.new(self[value])
49
56
  when TrueClass, FalseClass
@@ -54,12 +61,6 @@ class SassyHash < Hash
54
61
  raise SassyHashException, "Non convertable value given"
55
62
  end
56
63
  end
57
-
58
- def self.array_to_list(array)
59
- array.map do |value|
60
- sass_convert_value(value)
61
- end
62
- end
63
64
  end
64
65
 
65
66
 
data/sache.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "sassy_hash",
3
+ "description": "SassyHash is a Hash extension that is directly injectable into a Sass::Script::Value::Map",
4
+ "tags": ["ruby", "maps"]
5
+ }
@@ -55,14 +55,16 @@ describe SassyHash do
55
55
  end
56
56
 
57
57
  {
58
- 'foo' => ::Sass::Script::Value::String,
59
- 0 => ::Sass::Script::Value::Number,
60
- 1.0 => ::Sass::Script::Value::Number,
61
- "1.0px" => ::Sass::Script::Value::Number,
62
- '1px' => ::Sass::Script::Value::Number,
63
- :foo => ::Sass::Script::Value::String,
64
- true => ::Sass::Script::Value::Bool,
65
- false => ::Sass::Script::Value::Bool
58
+ "#fff" => ::Sass::Script::Value::Color,
59
+ "#eeeeee" => ::Sass::Script::Value::Color,
60
+ 'foo' => ::Sass::Script::Value::String,
61
+ 0 => ::Sass::Script::Value::Number,
62
+ 1.0 => ::Sass::Script::Value::Number,
63
+ "1.0px" => ::Sass::Script::Value::Number,
64
+ '1px' => ::Sass::Script::Value::Number,
65
+ :foo => ::Sass::Script::Value::String,
66
+ true => ::Sass::Script::Value::Bool,
67
+ false => ::Sass::Script::Value::Bool
66
68
  }.each do |instance, klass|
67
69
  it "should return #{klass} from #{instance.inspect}" do
68
70
  SassyHash.sass_convert_value(instance).class.should eq(klass)
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sassy_hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Davis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-07 00:00:00.000000000 Z
11
+ date: 2014-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sass
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: 3.3rc2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: 3.3rc2
55
55
  description: SassyHash is a Hash extension that is directly injectable into a Sass::Script::Value::Map
@@ -59,13 +59,14 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - ".gitignore"
63
- - ".rspec"
62
+ - .gitignore
63
+ - .rspec
64
64
  - Gemfile
65
65
  - LICENSE.txt
66
66
  - README.md
67
67
  - Rakefile
68
68
  - lib/sassy_hash.rb
69
+ - sache.json
69
70
  - sassy_hash.gemspec
70
71
  - spec/sass_hash_spec.rb
71
72
  - spec/spec_helper.rb
@@ -79,17 +80,17 @@ require_paths:
79
80
  - lib
80
81
  required_ruby_version: !ruby/object:Gem::Requirement
81
82
  requirements:
82
- - - ">="
83
+ - - ! '>='
83
84
  - !ruby/object:Gem::Version
84
85
  version: '0'
85
86
  required_rubygems_version: !ruby/object:Gem::Requirement
86
87
  requirements:
87
- - - ">="
88
+ - - ! '>='
88
89
  - !ruby/object:Gem::Version
89
90
  version: '0'
90
91
  requirements: []
91
92
  rubyforge_project:
92
- rubygems_version: 2.2.1
93
+ rubygems_version: 2.1.11
93
94
  signing_key:
94
95
  specification_version: 4
95
96
  summary: Hash converter for Sass::Script::Value::Map