Sha256: f24ca32136306b5d724b1c7eb85bd974ed3f9932d5c0f605de837375b03c77a6

Contents?: true

Size: 826 Bytes

Versions: 78

Compression:

Stored size: 826 Bytes

Contents

# source: https://github.com/intridea/hashie/blob/6d21c6868512603e77a340827ec91ecd3bcef078/lib/hashie/extensions/merge_initializer.rb
module Hashie
  module Extensions
    # The MergeInitializer is a super-simple mixin that allows
    # you to initialize a subclass of Hash with another Hash
    # to give you faster startup time for Hash subclasses. Note
    # that you can still provide a default value as a second
    # argument to the initializer.
    #
    # @example
    #   class MyHash < Hash
    #     include Hashie::Extensions::MergeInitializer
    #   end
    #
    #   h = MyHash.new(:abc => 'def')
    #   h[:abc] # => 'def'
    #
    module MergeInitializer
      def initialize(hash = {}, default = nil, &block)
        default ? super(default) : super(&block)
        update(hash)
      end
    end
  end
end

Version data entries

78 entries across 78 versions & 1 rubygems

Version Path
iron_worker_ng-1.6.10 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.6.9 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.6.8 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.6.7 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.6.6 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.6.5 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.6.4 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.6.3 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.6.2 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.6.1 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.5.2 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.5.1 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.5.0 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.4.2 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.4.1 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.4.0 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.3.0 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.2.0 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.1.0 lib/3rdparty/hashie/merge_initializer.rb
iron_worker_ng-1.0.4 lib/3rdparty/hashie/merge_initializer.rb