lib/ruby-measurement/unit.rb in ruby-measurement-1.2.1 vs lib/ruby-measurement/unit.rb in ruby-measurement-1.2.2
- old
+ new
@@ -43,10 +43,12 @@
def to_s
name
end
def ==(obj)
- obj.kind_of?(self.class) && hash == obj.hash
+ obj.kind_of?(self.class) && name == obj.name && aliases == obj.aliases && conversions.all? do |key, proc|
+ [-2.5, -1, 0, 1, 2.5].all? { |n| proc.call(n) == obj.conversions[key].call(n) }
+ end
end
def self.define(unit_name, &block)
Builder.new(unit_name, &block)
end