it does not test "same" - it tests if they are equal (Ruby has == for generic equal, eql? for type and value equal, and equal? for same instance. You use == in the implementation which means 1.0 == 1 (=> true) (vs.  1.0.eql?(1) => false)

I think you should eql? and call the method shallow_eql?

Alternatively, implement as two different classes ShallowCompare and DeepCompare, with just a single method eql?
<pre>
ShallowCompare.eql?(left, right)
DeepCompare.eql?(left, right)
</pre>
You can then skip the Util class, and just make Comparison a Module (name space). Others can then add additional comparisons without changing the utils class.