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



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

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

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



49
50
51
# File 'lib/devise/rails/warden_compat.rb', line 49

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

#delete(key) ⇒ Object



82
83
84
# File 'lib/devise/rails/warden_compat.rb', line 82

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

#fetch(key, *extras) ⇒ Object



70
71
72
# File 'lib/devise/rails/warden_compat.rb', line 70

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

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

Returns:

  • (Boolean)


62
63
64
# File 'lib/devise/rails/warden_compat.rb', line 62

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

#merge(hash) ⇒ Object



78
79
80
# File 'lib/devise/rails/warden_compat.rb', line 78

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

#regular_updateObject



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

alias_method :regular_update, :update

#regular_writerObject



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

alias_method :regular_writer, :[]=

#stringify_keysObject



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

def stringify_keys; dup end

#stringify_keys!Object



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

def stringify_keys!; self end

#symbolize_keysObject



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

def symbolize_keys; to_hash.symbolize_keys end

#to_hashObject



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

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

#to_options!Object



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

def to_options!; self end

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



55
56
57
58
# File 'lib/devise/rails/warden_compat.rb', line 55

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

#values_at(*indices) ⇒ Object



74
75
76
# File 'lib/devise/rails/warden_compat.rb', line 74

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