class Version

Attributes

build[RW]
major[RW]
minor[RW]

Public Class Methods

new(major, minor, build) click to toggle source
# File lib/fastlane/plugin/gs_versioning/helper/gs_version_api_provider.rb, line 4
def initialize(major, minor, build)
  # assign instance avriables
  @major, @minor, @build = major, minor, build
end
parse(parsed) click to toggle source
# File lib/fastlane/plugin/gs_versioning/helper/gs_version_api_provider.rb, line 9
def self.parse(parsed)
  #TODO: впилить проверку на правильный формат
  {'beta' => self.parse_beta(parsed), 'rc' => self.parse_rc(parsed), 'release' => self.parse_release(parsed)}
end
parse_beta(parsed) click to toggle source
# File lib/fastlane/plugin/gs_versioning/helper/gs_version_api_provider.rb, line 18
def self.parse_beta(parsed)
  beta_version = parsed["beta"]
  self.parse_string(beta_version)
end
parse_rc(parsed) click to toggle source
# File lib/fastlane/plugin/gs_versioning/helper/gs_version_api_provider.rb, line 23
def self.parse_rc(parsed)
  rc_version = parsed["rc"]
  self.parse_string(rc_version)
end
parse_release(parsed) click to toggle source
# File lib/fastlane/plugin/gs_versioning/helper/gs_version_api_provider.rb, line 28
def self.parse_release(parsed)
  release_version = parsed["release"]
  self.parse_string(release_version)
end
parse_string(str) click to toggle source
# File lib/fastlane/plugin/gs_versioning/helper/gs_version_api_provider.rb, line 33
def self.parse_string(str)
  # puts('Parsing version str ' + str)
  v_elements = str.split(pattern='.')
  build_value = v_elements[1].split(pattern='(')[1].split(pattern=')')[0]
  Version.new(v_elements[0].to_i, v_elements[1].to_i, build_value.to_i)
end

Public Instance Methods

<=(other) click to toggle source
# File lib/fastlane/plugin/gs_versioning/helper/gs_version_api_provider.rb, line 40
def <= (other)
  if @major < other.major
    return true
  elsif @major == other.major && @minor < other.minor
    return true
  elsif @major == other.major && @minor == other.minor && @build < other.build
    return true
  elsif @major == other.major && @minor == other.minor && @build == other.build
    return true
  end
  false
end
toString() click to toggle source
# File lib/fastlane/plugin/gs_versioning/helper/gs_version_api_provider.rb, line 53
def toString
  res = @major.to_s + '.' + @minor.to_s + '(' + @build.to_s + ')'
end
to_s() click to toggle source
# File lib/fastlane/plugin/gs_versioning/helper/gs_version_api_provider.rb, line 14
def to_s
  self.toString
end