Sha256: 38915e379ea6040c42f40a79fb9e1fc4c0d87e269c8c51157a40c6fbd23c44f9

Contents?: true

Size: 516 Bytes

Versions: 38

Compression:

Stored size: 516 Bytes

Contents

module CFoundry
  class ChattyHash
    include Enumerable

    def initialize(callback, hash = {})
      @callback = callback
      @hash = hash
    end

    def [](name)
      @hash[name]
    end

    def []=(name, value)
      @hash[name] = value
      @callback.call(self)
      value
    end

    def each(&blk)
      @hash.each(&blk)
    end

    def delete(key)
      value = @hash.delete(key)
      @callback.call(self)
      value
    end

    def to_json(*args)
      @hash.to_json(*args)
    end
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
cfoundry-IronFoundry-0.3.39 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.39 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.38 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.37 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.36 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.35 lib/cfoundry/chatty_hash.rb
cfoundry-IronFoundry-0.3.34 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.34 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.33 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.32 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.31 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.30 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.29 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.28 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.27 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.26 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.25 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.24 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.23 lib/cfoundry/chatty_hash.rb
cfoundry-0.3.22 lib/cfoundry/chatty_hash.rb