dry_css 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc0ed26d7724ef6b7ecf1c9dc5d1483ff4ce006f
4
- data.tar.gz: c6fc90223428c1cc543ecfd9b6867bc4649432b8
3
+ metadata.gz: 0cc21deeea99eb04e0ea76e0ac6fb026b0a5399d
4
+ data.tar.gz: c880cb5ffe464fb6708717867a202e525cc54756
5
5
  SHA512:
6
- metadata.gz: d66200aceae8baf15828e905ea661cc636619d0bac385e53ed4310610b21977876a5dba0308be8e92f3ee81fa1fa0ac0f7cbe78bb6de383a2ecf696ab970329e
7
- data.tar.gz: ae456c39dbc23c2e687ba219fc5a224f220df48ad45c78581ef51ec394e48be84197852f9b936b32861c22d385b8963cb512b70bbcf4603d2d2a2bb229ce8943
6
+ metadata.gz: 2e0929f89775c36e6b4e59f9c1b19eb2ded19a2dfeae09700dbb4d86ba261aca3df5584cf01b72c1081472286ad7d62fd329af8d70857856a16fd58df215f708
7
+ data.tar.gz: 4f7873ac64b3dbc17ea39d179d8d3e6593f979eaa442f2cf87bf3a0a8226dfc2d30bc2ca70166fdacfd16d9a426657ff3e67281e93cb3a9549cf9e74a162887c
data/lib/dry_css/css.rb CHANGED
@@ -18,15 +18,16 @@ module DryCss
18
18
 
19
19
  def scan_for(property)
20
20
  @property = property
21
- @values_hash = {}
21
+ @values_hash = {:counts => {}, :total => 0}
22
22
  @parser.each_selector do |selector, declarations, specificity|
23
23
  if d_val = declarations.scan(/([\w-]+):[ ]?(#{@property})/)
24
24
  d_val.each do |val|
25
- if @values_hash[val[1].to_sym].nil?
26
- @values_hash.merge!(val[1].to_sym => 1)
25
+ if @values_hash[:counts][val[1].to_sym].nil?
26
+ @values_hash[:counts].merge!(val[1].to_sym => 1)
27
27
  else
28
- @values_hash[val[1].to_sym] += 1
28
+ @values_hash[:counts][val[1].to_sym] += 1
29
29
  end
30
+ @values_hash[:total] += 1
30
31
  end
31
32
  end
32
33
  end
@@ -1,3 +1,3 @@
1
1
  module DryCss
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/spec/lib/css_spec.rb CHANGED
@@ -11,7 +11,7 @@ describe DryCss::CSS do
11
11
  end
12
12
 
13
13
  it 'returns array of color values' do
14
- @css.colors.should eq({:"#fff;"=>1, :"#000;"=>2})
14
+ @css.colors.should eq({:counts => {:"#fff;"=>1, :"#000;"=>2}, :total => 3})
15
15
  end
16
16
 
17
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry_css
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - gpxl