Sha256: ea1b411522735099c4e66219b7a913370d2e2903b1c50e9ee760a3aa922cebd2

Contents?: true

Size: 555 Bytes

Versions: 14

Compression:

Stored size: 555 Bytes

Contents

module Chillout
  class CreationsContainer
    def initialize
      @container = Hash.new {|hash, key| hash[key] = 0}
    end

    def increment!(class_name, value=1)
      key = key(class_name)
      @container[key] += value
    end

    def [](name)
      key = key(name)
      @container[key]
    end

    def key(name)
      name.to_sym
    end

    def resource_keys
      @container.keys
    end

    def merge(other_container)
      for key in other_container.resource_keys
        increment!(key, other_container[key])
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
chillout-0.8.2 lib/chillout/creations_container.rb
chillout-0.8.1 lib/chillout/creations_container.rb
chillout-0.8.0 lib/chillout/creations_container.rb
chillout-0.6.0 lib/chillout/creations_container.rb
chillout-0.5.4 lib/chillout/creations_container.rb
chillout-0.5.3 lib/chillout/creations_container.rb
chillout-0.5.2 lib/chillout/creations_container.rb
chillout-0.5.1 lib/chillout/creations_container.rb
chillout-0.5.0 lib/chillout/creations_container.rb
chillout-0.4.1 lib/chillout/creations_container.rb
chillout-0.4.0 lib/chillout/creations_container.rb
chillout-0.3.0 lib/chillout/creations_container.rb
chillout-0.2.3 lib/chillout/creations_container.rb
chillout-0.2.2 lib/chillout/creations_container.rb