lib/xdr/union.rb in xdr-0.0.4 vs lib/xdr/union.rb in xdr-0.1.0
- old
+ new
@@ -112,9 +112,19 @@
return false unless other.is_a?(self.class)
return false unless other.switch == self.switch
other.value == self.value
end
+ def eql?(other)
+ return false unless other.is_a?(self.class)
+ return false unless other.switch.eql? self.switch
+ other.value.eql? self.value
+ end
+
+ def hash
+ [self.class, self.switch, self.value].hash
+ end
+
private
def valid_for_arm_type(value, arm)
arm_type = arms[@arm]
return value == :void if arm_type.nil?