CSS Parser
Ruby
code posted
by
mg
created at 30 Sep 10:11
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
require 'css_parser' class InlineStyle class CssParserWrapper attr_accessor :rules def initialize(css_code) parser, @rules = CssParser::Parser.new, [] parser.add_block! css_code parser.each_rule_set do |rule_set| rule_set.each_selector { |sel, dec, spec| @rules << Rule.new(sel, dec, '%04d' % spec.to_i) } end end end end |
387 Bytes in 2 ms with coderay