lib/origin/key.rb in origin-1.0.9 vs lib/origin/key.rb in origin-1.0.10
- old
+ new
@@ -14,18 +14,29 @@
# Does the key equal another object?
#
# @example Is the key equal to another?
# key == other
+ # key.eql? other
#
# @param [ Object ] other The object to compare to.
#
# @return [ true, false ] If the objects are equal.
#
# @since 1.0.0
def ==(other)
return false unless other.is_a?(Key)
name == other.name && operator == other.operator && expanded == other.expanded
+ end
+ alias :eql? :==
+
+ # Calculate the hash code for a key.
+ #
+ # @return [ Fixnum ] The hash code for the key.
+ #
+ # @since 1.1.0
+ def hash
+ [name, operator, expanded].hash
end
# Instantiate the new key.
#
# @example Instantiate the key.