Module: Hashie::Extensions::Coercion::InstanceMethods

### Home Classes Methods

### In Files

- lib/hashie/extensions/coercion.rb

### Methods

- #[]=
- #custom_writer
- #replace

### 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::Coercion::InstanceMethods

### Public Instance Methods

[]=(key, value) click to toggle source

    # File lib/hashie/extensions/coercion.rb, line 10
    def []=(key, value)
      into = self.class.key_coercion(key) || self.class.value_coercion(value)

      if value && into
        if into.respond_to?(:coerce)
          value = into.coerce(value)
        else
          value = into.new(value)
        end
      end

      super(key, value)
    end

custom_writer(key, value, convert = true) click to toggle source

    # File lib/hashie/extensions/coercion.rb, line 24
    def custom_writer(key, value, convert = true)
      self[key] = value
    end

replace(other_hash) click to toggle source

    # File lib/hashie/extensions/coercion.rb, line 28
    def replace(other_hash)
      (keys - other_hash.keys).each { |key| delete(key) }
      other_hash.each { |key, value| self[key] = value }
      self
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.