lib/ecu/labels/value_comparison.rb in automotive-ecu-0.1.6 vs lib/ecu/labels/value_comparison.rb in automotive-ecu-0.1.7

- old
+ new

@@ -5,17 +5,15 @@ # check_compatibility(left, right) @left, @right = left, right end def eql? - return false unless @left.class == @right.class - case @left - when NilClass then @left == @right - when String then @left == @right - when Numeric then @left == @right - when Array then arrays_eql?(@left, @right) - else - fail "Unkown value class: #{@left.class}" + case [@left, @right] + in [NilClass, NilClass] then @left == @right + in [String, String] then @left == @right + in [Numeric, Numeric] then @left == @right + in [Array, Array] then arrays_eql?(@left, @right) + in [_, _] then false end end private