Module: Hashie::Extensions::MergeInitializer

### Home Classes Methods

### In Files

- lib/hashie/extensions/merge_initializer.rb

### Methods

- ::new

### Class/Module Index

Quicksearch

- Hashie
- Hashie::Clash
- Hashie::Clash::ChainError
- Hashie::Dash
- Hashie::Extensions
- Hashie::Extensions::Coercion
- Hashie::Extensions::Coercion::ClassMethods
- Hashie::Extensions::Coercion::InstanceMethods
- Hashie::Extensions::DeepFetch
- Hashie::Extensions::DeepFetch::UndefinedPathError
- Hashie::Extensions::DeepMerge
- Hashie::Extensions::IgnoreUndeclared
- Hashie::Extensions::IndifferentAccess
- Hashie::Extensions::KeyConversion
- Hashie::Extensions::MergeInitializer
- Hashie::Extensions::MethodAccess
- Hashie::Extensions::MethodQuery
- Hashie::Extensions::MethodReader
- Hashie::Extensions::MethodWriter
- Hashie::Extensions::StringifyKeys
- Hashie::Extensions::SymbolizeKeys
- Hashie::Hash
- Hashie::HashExtensions
- Hashie::Mash
- Hashie::PrettyInspect
- Hashie::Rash
- Hashie::Trash

No matching classes.

# Hashie::Extensions::MergeInitializer

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'

### Public Class Methods

new(hash = {}, default = nil, &block) click to toggle source

    # File lib/hashie/extensions/merge_initializer.rb, line 18
    def initialize(hash = {}, default = nil, &block)
      default ? super(default) : super(&block)
      hash.each do |key, value|
        self[key] = value
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.