lib/style_stats/css.rb in style_stats-0.0.1 vs lib/style_stats/css.rb in style_stats-0.1.0

- old
+ new

@@ -6,19 +6,20 @@ class StyleStats class Css attr_accessor :path, :paths, :rules, :media_types, :selectors, :stylesheets, :elements - def initialize(path = nil) + def initialize(path = nil, options = {}) self.path = path self.paths = path ? [path] : [] self.rules = [] self.media_types = [] self.selectors = [] self.stylesheets = [] self.elements = [] + @options = options parse if path end def merge(css) dup.merge!(css) @@ -93,10 +94,10 @@ self.selectors.map(&:declarations).flatten end private def parse - fetch = Fetch.new(self.path) + fetch = Fetch.new(self.path, @options) self.stylesheets = fetch.stylesheets self.elements = fetch.elements parsers = (self.stylesheets + self.elements).inject([]) { |parsers, style| parsers.push(create_css_parser(style)) }