Sha256: 63513c2bdfbcff6ce3c563d1dae82639b5bac4a1f310eb5709ca4572c8d27f34

Contents?: true

Size: 547 Bytes

Versions: 7

Compression:

Stored size: 547 Bytes

Contents

class StyleStats::Css
  class AggregateDeclaration
    attr_accessor :declarations

    def initialize()
      self.declarations = {}
    end

    def add(property, value)
      if self.declarations.has_key?(property)
        self.declarations[property][:values] << value
        self.declarations[property][:values].uniq!
        self.declarations[property][:count] += 1
      else
        self.declarations[property] = {values: [value], count: 1}
      end
    end

    def [](property)
      self.declarations[property] || {}
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
style_stats-0.4.2 lib/style_stats/css/aggregate_declaration.rb
style_stats-0.4.1 lib/style_stats/css/aggregate_declaration.rb
style_stats-0.4.0 lib/style_stats/css/aggregate_declaration.rb
style_stats-0.3.0 lib/style_stats/css/aggregate_declaration.rb
style_stats-0.2.0 lib/style_stats/css/aggregate_declaration.rb
style_stats-0.1.0 lib/style_stats/css/aggregate_declaration.rb
style_stats-0.0.1 lib/style_stats/css/aggregate_declaration.rb