lib/solve/version.rb in solve-0.4.2 vs lib/solve/version.rb in solve-0.4.3

- old
+ new

@@ -1,7 +1,7 @@ module Solve - # @author Jamie Winsor <jamie@vialstudios.com> + # @author Jamie Winsor <reset@riotgames.com> # @author Thibaud Guillaume-Gentil <thibaud@thibaud.me> class Version class << self # @param [#to_s] version_string # @@ -55,13 +55,15 @@ @major, @minor, @patch, @pre_release, @build = args.first else @major, @minor, @patch, @pre_release, @build = self.class.split(args.first.to_s) end - @major ||= 0 - @minor ||= 0 - @patch ||= 0 + @major ||= 0 + @minor ||= 0 + @patch ||= 0 + @pre_release ||= nil + @build ||= nil end # @param [Solve::Version] other # # @return [Integer] @@ -85,9 +87,13 @@ # @return [Array] def identifiers(release) send(release).to_s.split('.').map do |str| str.to_i.to_s == str ? str.to_i : str end + end + + def pre_release? + !!pre_release end # @return [Integer] def pre_release_and_build_presence_score pre_release ? 0 : (build.nil? ? 1 : 2)