Class: Fastlane::Wpmreleasetoolkit::Versioning::FourPartVersionFormatter

Inherits:
AbstractVersionFormatter show all
Defined in:
lib/fastlane/plugin/wpmreleasetoolkit/versioning/formatters/four_part_version_formatter.rb

Overview

The ‘FourPartVersionFormatter` class extends the `VersionFormatter` class. It is a specialized version formatter for apps that use versions in the format of `1.2.3.4`.

Instance Method Summary collapse

Methods inherited from AbstractVersionFormatter

#release_version

Instance Method Details

#parse(version) ⇒ AppVersion

Parse the version string into an AppVersion instance

Parameters:

  • version (String)

    The version string to parse

Returns:

  • (AppVersion)

    The parsed version



15
16
17
18
19
20
21
# File 'lib/fastlane/plugin/wpmreleasetoolkit/versioning/formatters/four_part_version_formatter.rb', line 15

def parse(version)
  # Split the version string into its components
  components = version.split('.').map(&:to_i)

  # Create a new AppVersion instance from the version string components
  Fastlane::Models::AppVersion.new(*components)
end

#to_s(version) ⇒ String

Return the formatted version string

Parameters:

  • version (AppVersion)

    The version object to format

Returns:

  • (String)

    The formatted version string



29
30
31
# File 'lib/fastlane/plugin/wpmreleasetoolkit/versioning/formatters/four_part_version_formatter.rb', line 29

def to_s(version)
  "#{version.major}.#{version.minor}.#{version.patch}.#{version.build_number}"
end