Sha256: 6411c6a56dfd318148184ac922e6a2a6ee6423267bd2aee9b1828d7e798baf54

Contents?: true

Size: 995 Bytes

Versions: 24

Compression:

Stored size: 995 Bytes

Contents

require_relative 'condition_utils'

module Antrapol
  module ToolRack
    module VersionUtils
      include Antrapol::ToolRack::ConditionUtils

      class VersionUtilsError < StandardError; end

      def is_version_equal?(*args)
        res = true
        target = Gem::Version.new(args.first)
        args.each do |a|
          subj = Gem::Version.new(a)
          res = (subj == target)
          break if not res
          target = subj
        end

        res
      end

      def possible_versions(ver)
        raise VersionUtilsError, "Given version to extrapolate is empty" if is_empty?(ver)
        vv = ver.to_s.split('.')
        tv = vv.clone
        res = []
        cnt = 0
        (0...vv.length).each do |i|
          tv = vv.clone
          tv[i] = tv[i].to_i+1

          j = i
          loop do
            break if j >= (vv.length-1)
            j += 1
            tv[j] = 0
          end
          res << tv.join(".")
        end
        res
      end

    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
toolrack-0.24.3 lib/toolrack/version_utils.rb
toolrack-0.24.2 lib/toolrack/version_utils.rb
toolrack-0.24.1 lib/toolrack/version_utils.rb
toolrack-0.24.0 lib/toolrack/version_utils.rb
toolrack-0.23.3 lib/toolrack/version_utils.rb
toolrack-0.23.2 lib/toolrack/version_utils.rb
toolrack-0.22.1 lib/toolrack/version_utils.rb
toolrack-0.22.0 lib/toolrack/version_utils.rb
toolrack-0.21.0 lib/toolrack/version_utils.rb
toolrack-0.20.2 lib/toolrack/version_utils.rb
toolrack-0.20.1 lib/toolrack/version_utils.rb
toolrack-0.20.0 lib/toolrack/version_utils.rb
toolrack-0.19.1 lib/toolrack/version_utils.rb
toolrack-0.18.6 lib/toolrack/version_utils.rb
toolrack-0.18.5 lib/toolrack/version_utils.rb
toolrack-0.18.4 lib/toolrack/version_utils.rb
toolrack-0.18.3 lib/toolrack/version_utils.rb
toolrack-0.18.2 lib/toolrack/version_utils.rb
toolrack-0.18.1 lib/toolrack/version_utils.rb
toolrack-0.18.0 lib/toolrack/version_utils.rb