Sha256: 953c6dca340e89680d3cb0fb1f29b6331ab83f9ecd5ed5934e08f619f09e00a2
Contents?: true
Size: 694 Bytes
Versions: 13
Compression:
Stored size: 694 Bytes
Contents
module Hashie2 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 Hashie2::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
13 entries across 13 versions & 1 rubygems