lib/run_loop/version.rb in run_loop-1.5.5 vs lib/run_loop/version.rb in run_loop-1.5.6.pre1

- old
+ new

@@ -1,7 +1,7 @@ module RunLoop - VERSION = '1.5.5' + VERSION = '1.5.6.pre1' # A model of a software release version that can be used to compare two versions. # # Calabash and RunLoop try very hard to comply with Semantic Versioning rules. # However, the semantic versioning spec is incompatible with RubyGem's patterns @@ -42,19 +42,19 @@ # version = Version.new(0.10.1) # version.major => 0 # version.minor => 10 # version.patch => 1 # version.pre => false - # version.pre_release => nil + # version.pre_version => nil # # @example # version = Version.new(1.6.3.pre5) # version.major => 1 # version.minor => 6 # version.patch => 3 # version.pre => true - # version.pre_release => 5 + # version.pre_version => 5 # # @param [String] version the version string to parse. # @raise [ArgumentError] if version is not in the form 5, 6.1, 7.1.2, 8.2.3.pre1 def initialize(version) tokens = version.strip.split('.') @@ -84,9 +84,21 @@ str end def inspect "#<Version #{to_s}>" + end + + # Compare this version to another for _object_ equality. This allows + # Version instances to be used as Hash keys. + # @param [Version] other the version to compare against. + def eql?(other) + hash == other.hash + end + + # The hash method for this instance. + def hash + to_s.hash end # Compare this version to another for equality. # @param [Version] other the version to compare against # @return [Boolean] true if this Version is the same as `other`