File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ def <=>(other)
107107 # Return true if `other` contains the same elements, in the same order.
108108 # @return [Boolean]
109109 def ==( other )
110- self . eql? ( other ) || other . respond_to? ( :to_ary ) && to_ary . eql? ( other . to_ary )
110+ self . eql? ( other ) || ( other . respond_to? ( :to_ary ) && to_ary == other . to_ary )
111111 end
112112
113113 # Convert all the elements into strings and join them together, separated by
Original file line number Diff line number Diff line change @@ -771,7 +771,7 @@ def eql?(other)
771771 # @param other [Object] The object to compare with
772772 # @return [Boolean]
773773 def ==( other )
774- self . eql? ( other ) || ( other . respond_to? ( :to_hash ) && to_hash . eql? ( other . to_hash ) )
774+ self . eql? ( other ) || ( other . respond_to? ( :to_hash ) && to_hash == other . to_hash )
775775 end
776776
777777 # Return true if this `Hash` is a proper superset of `other`, which means
Original file line number Diff line number Diff line change 11require "spec_helper"
2+ require "bigdecimal"
23
34describe Immutable ::Hash do
45 let ( :hash ) { H [ "A" => "aye" , "B" => "bee" , "C" => "see" ] }
3334 instance = subclass . new ( "A" => "aye" , "B" => "bee" , "C" => "see" )
3435 ( hash == instance ) . should == true
3536 end
37+
38+ it "performs numeric conversions between floats and BigDecimals" do
39+ expect ( H [ a : 0.0 ] == H [ a : BigDecimal ( '0.0' ) ] ) . to be true
40+ expect ( H [ a : BigDecimal ( '0.0' ) ] == H [ a : 0.0 ] ) . to be true
41+ end
3642 end
3743
3844 [ :eql? , :== ] . each do |method |
You can’t perform that action at this time.
0 commit comments