Class: InlineStyle::CssParserWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/inline-style/css_parser_wrapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(css_code) ⇒ CssParserWrapper

Returns a new instance of CssParserWrapper.



7
8
9
10
11
12
13
# File 'lib/inline-style/css_parser_wrapper.rb', line 7

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

Instance Attribute Details

#rulesObject

Returns the value of attribute rules.



5
6
7
# File 'lib/inline-style/css_parser_wrapper.rb', line 5

def rules
  @rules
end