Sha256: 977c9d103ed01a6209c53ff0c8d335dc0b8646c09d51c83e554b87097c5ce9d4
Contents?: true
Size: 692 Bytes
Versions: 8
Compression:
Stored size: 692 Bytes
Contents
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
8 entries across 8 versions & 3 rubygems