Class: Fastlane::Wpmreleasetoolkit::Versioning::AbstractVersionFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/wpmreleasetoolkit/versioning/formatters/abstract_version_formatter.rb

Overview

The ‘VersionFormatter` class is a generic version formatter that can be used as a base class for formatting version objects used by for different platforms. It contains formatting methods that are shared by all platforms. It has the abstract suffix because it should not be instantiated directly.

Instance Method Summary collapse

Instance Method Details

#release_version(version) ⇒ String

Get the release version string for the app.

This method constructs the release version string based on the major, minor, and patch components of the provided ‘@version`. If the patch component is zero, it returns a version string in the format “major.minor” (e.g., ’1.2’). Otherwise, it returns a version string in the format “major.minor.patch” (e.g., ‘1.2.3’).

Parameters:

  • version (AppVersion)

    The version object to format

Returns:

  • (String)

    The formatted release version string.



21
22
23
# File 'lib/fastlane/plugin/wpmreleasetoolkit/versioning/formatters/abstract_version_formatter.rb', line 21

def release_version(version)
  version.patch.zero? ? "#{version.major}.#{version.minor}" : "#{version.major}.#{version.minor}.#{version.patch}"
end