Sha256: e49436691d129cc17a3ea30670645ca6094cef10b9768b7bc6d667dab6f7d066
Contents?: true
Size: 541 Bytes
Versions: 1
Compression:
Stored size: 541 Bytes
Contents
module BeautifulCss class Rule attr_accessor :selector, :prop, :value def initialize(selector, prop, value) @selector, @prop, @value = cleaner(selector), (prop || '').downcase, value end def cleaner sel sel.to_s.split(' ').map do |part| #only tags are case insensitive tag = part.split(/\.|#/)[0] to_replace = Regexp.new("^"+ tag) part.gsub to_replace, tag.downcase end.join(' ') end def to_s @selector + "\n" + "{ #{prop}:#{value} }" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
beautiful-css-0.1.02 | lib/beautiful-css/rule.rb |