Class: Devise::IndifferentHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/devise/rails/warden_compat.rb

Overview

We cannot use Rails Indifferent Hash because it messes up the flash object.

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



47
48
49
# File 'lib/devise/rails/warden_compat.rb', line 47

def [](key)
  super(convert_key(key))
end

#[]=(key, value) ⇒ Object Also known as: store



51
52
53
# File 'lib/devise/rails/warden_compat.rb', line 51

def []=(key, value)
  regular_writer(convert_key(key), value)
end

#delete(key) ⇒ Object



84
85
86
# File 'lib/devise/rails/warden_compat.rb', line 84

def delete(key)
  super(convert_key(key))
end

#fetch(key, *extras) ⇒ Object



72
73
74
# File 'lib/devise/rails/warden_compat.rb', line 72

def fetch(key, *extras)
  super(convert_key(key), *extras)
end

#key?(key) ⇒ Boolean Also known as: include?, has_key?, member?

Returns:

  • (Boolean)


64
65
66
# File 'lib/devise/rails/warden_compat.rb', line 64

def key?(key)
  super(convert_key(key))
end

#merge(hash) ⇒ Object



80
81
82
# File 'lib/devise/rails/warden_compat.rb', line 80

def merge(hash)
  self.dup.update(hash)
end

#regular_updateObject



45
# File 'lib/devise/rails/warden_compat.rb', line 45

alias_method :regular_update, :update

#regular_writerObject



44
# File 'lib/devise/rails/warden_compat.rb', line 44

alias_method :regular_writer, :[]=

#stringify_keysObject



89
# File 'lib/devise/rails/warden_compat.rb', line 89

def stringify_keys; dup end

#stringify_keys!Object



88
# File 'lib/devise/rails/warden_compat.rb', line 88

def stringify_keys!; self end

#symbolize_keysObject



92
# File 'lib/devise/rails/warden_compat.rb', line 92

def symbolize_keys; to_hash.symbolize_keys end

#to_hashObject



95
# File 'lib/devise/rails/warden_compat.rb', line 95

def to_hash; Hash.new.update(self) end

#to_options!Object



94
# File 'lib/devise/rails/warden_compat.rb', line 94

def to_options!; self end

#update(other_hash) ⇒ Object Also known as: merge!



57
58
59
60
# File 'lib/devise/rails/warden_compat.rb', line 57

def update(other_hash)
  other_hash.each_pair { |key, value| regular_writer(convert_key(key), value) }
  self
end

#values_at(*indices) ⇒ Object



76
77
78
# File 'lib/devise/rails/warden_compat.rb', line 76

def values_at(*indices)
  indices.collect {|key| self[convert_key(key)]}
end