-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
I wrote a helper method to get attributes hash/hashes out of some known data types like this
case obj when Hash then obj when Mongoid::Relations::Targets::Enumerable, Array, Mongoid::Criteria then obj.map(&:attrs) when Error, Mongoid::Document then obj.attrs end
while obj.class == Mongoid::Relations::Targets::Enumerable the second branch get skipped. I dug into the code, found === method had been overridden:
def ===(other) other.class == Class ? Array == other : self == other end
such that its instances cannot match it in a case statement.