Class: InlineStyle::CSSPoolWrapper

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(css_code) ⇒ CSSPoolWrapper

Returns a new instance of CSSPoolWrapper.



5
6
7
8
9
10
# File 'lib/inline-style/csspool_wrapper.rb', line 5

def initialize css_code
  parser = CSSPool.CSS css_code
  @rules = parser.rule_sets.map do |rule_set| 
    rule_set.selectors.map { |sel| Rule.new(sel.to_s, sel.declarations.join, "0#{sel.specificity.join}") }
  end.flatten 
end

Instance Attribute Details

#rulesObject

Returns the value of attribute rules.



3
4
5
# File 'lib/inline-style/csspool_wrapper.rb', line 3

def rules
  @rules
end