Class: TFG::Support::HashWithIndifferentEquality
- Inherits:
-
BasicObject
- Defined in:
- lib/tfg/support/hash_with_indifferent_equality.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of HashWithIndifferentEquality.
4
5
6
|
# File 'lib/tfg/support/hash_with_indifferent_equality.rb', line 4
def initialize(hash)
@hash = hash
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
26
27
28
|
# File 'lib/tfg/support/hash_with_indifferent_equality.rb', line 26
def method_missing(name, *args, &block)
@hash.public_send(name, *args, &block)
end
|
Instance Method Details
#==(other) ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/tfg/support/hash_with_indifferent_equality.rb', line 16
def ==(other)
if other.is_a?(::Hash)
@hash.with_indifferent_access == other.with_indifferent_access
else
@hash == other
end
end
|
#is_a?(klass) ⇒ Boolean
8
9
10
11
12
13
14
|
# File 'lib/tfg/support/hash_with_indifferent_equality.rb', line 8
def is_a?(klass)
if klass == ::TFG::Support::HashWithIndifferentEquality
return true
else
super
end
end
|