beautiful-css 0.0.9 → 0.0.10
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.
- data/lib/beautiful-css/rule.rb +11 -1
- data/lib/beautiful-css/version.rb +1 -1
- data/spec/convertions_spec.rb +16 -0
- metadata +2 -2
data/lib/beautiful-css/rule.rb
CHANGED
@@ -4,7 +4,17 @@ module BeautifulCss
|
|
4
4
|
attr_accessor :selector, :prop, :value
|
5
5
|
|
6
6
|
def initialize(selector, prop, value)
|
7
|
-
@selector, @prop, @value = selector, prop, value
|
7
|
+
@selector, @prop, @value = cleaner(selector), (prop || '').downcase, value
|
8
|
+
end
|
9
|
+
|
10
|
+
def cleaner sel
|
11
|
+
sel.to_s.split(' ').map do |part|
|
12
|
+
if part =~ /^[^\.^#]/
|
13
|
+
part.downcase
|
14
|
+
else
|
15
|
+
part
|
16
|
+
end
|
17
|
+
end.join(' ')
|
8
18
|
end
|
9
19
|
|
10
20
|
def to_s
|
data/spec/convertions_spec.rb
CHANGED
@@ -166,6 +166,22 @@ CLEAN
|
|
166
166
|
|
167
167
|
|
168
168
|
|
169
|
+
it 'should ignore case for style' do
|
170
|
+
dirty = <<DIRTY
|
171
|
+
a
|
172
|
+
{ background:green; }
|
173
|
+
a
|
174
|
+
{ BACKGROUND:green; }
|
175
|
+
DIRTY
|
176
|
+
clean = <<CLEAN
|
177
|
+
a
|
178
|
+
{ background:green }
|
179
|
+
CLEAN
|
180
|
+
assert_renders dirty, clean
|
181
|
+
end
|
182
|
+
|
183
|
+
|
184
|
+
|
169
185
|
|
170
186
|
|
171
187
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beautiful-css
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A tool to help cleanup css
|
15
15
|
email:
|