Class: Fastlane::Models::AppVersion

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/wpmreleasetoolkit/models/app_version.rb

Overview

The AppVersion model represents a version of an app with major, minor, patch, and build number components.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(major, minor, patch = 0, build_number = 0) ⇒ AppVersion

Initializes a new AppVersion instance.

Parameters:

  • major (Integer)

    The major version number.

  • minor (Integer)

    The minor version number.

  • patch (Integer) (defaults to: 0)

    The patch version number.

  • build_number (Integer) (defaults to: 0)

    The build number.



14
15
16
17
18
19
20
21
22
23
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/app_version.rb', line 14

def initialize(major, minor, patch = 0, build_number = 0)
  # Validate that the major and minor version numbers are not nil
  UI.user_error!('Major version cannot be nil') if major.nil?
  UI.user_error!('Minor version cannot be nil') if minor.nil?

  @major = major
  @minor = minor
  @patch = patch
  @build_number = build_number
end

Instance Attribute Details

#build_numberObject

Returns the value of attribute build_number.



5
6
7
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/app_version.rb', line 5

def build_number
  @build_number
end

#majorObject

Returns the value of attribute major.



5
6
7
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/app_version.rb', line 5

def major
  @major
end

#minorObject

Returns the value of attribute minor.



5
6
7
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/app_version.rb', line 5

def minor
  @minor
end

#patchObject

Returns the value of attribute patch.



5
6
7
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/app_version.rb', line 5

def patch
  @patch
end

Instance Method Details

#to_sString

Converts the AppVersion object to a string representation. This should only be used for internal debugging/testing purposes, not to write versions in version files In order to format an ‘AppVersion` into a `String`, you should use the appropriate `VersionFormatter` for your project instead.

Returns:

  • (String)

    a string in the format “major.minor.patch.build_number”.



31
32
33
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/app_version.rb', line 31

def to_s
  "#{@major}.#{@minor}.#{@patch}.#{@build_number}"
end