lib/beautiful-css/rule.rb in beautiful-css-0.0.9 vs lib/beautiful-css/rule.rb in beautiful-css-0.0.10
- old
+ new
@@ -2,10 +2,20 @@
class Rule
attr_accessor :selector, :prop, :value
def initialize(selector, prop, value)
- @selector, @prop, @value = selector, prop, value
+ @selector, @prop, @value = cleaner(selector), (prop || '').downcase, value
+ end
+
+ def cleaner sel
+ sel.to_s.split(' ').map do |part|
+ if part =~ /^[^\.^#]/
+ part.downcase
+ else
+ part
+ end
+ end.join(' ')
end
def to_s
@selector + "\n" + "{ #{prop}:#{value} }"
end