Class: Fastlane::Actions::Version
- Inherits:
-
Object
- Object
- Fastlane::Actions::Version
- Includes:
- Comparable
- Defined in:
- lib/fastlane/plugin/gitlab_get_max_version_branch/actions/gitlab_get_max_version_branch_action.rb
Instance Attribute Summary collapse
-
#full_version ⇒ Object
readonly
Returns the value of attribute full_version.
-
#major ⇒ Object
readonly
Returns the value of attribute major.
-
#minor ⇒ Object
readonly
Returns the value of attribute minor.
-
#patch ⇒ Object
readonly
Returns the value of attribute patch.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(version_str) ⇒ Version
constructor
A new instance of Version.
- #to_s ⇒ Object
Constructor Details
#initialize(version_str) ⇒ Version
Returns a new instance of Version.
10 11 12 13 |
# File 'lib/fastlane/plugin/gitlab_get_max_version_branch/actions/gitlab_get_max_version_branch_action.rb', line 10 def initialize(version_str) @full_version = version_str @major, @minor, @patch = version_str.strip.gsub('master_', '').split('.').map(&:to_i) end |
Instance Attribute Details
#full_version ⇒ Object (readonly)
Returns the value of attribute full_version.
8 9 10 |
# File 'lib/fastlane/plugin/gitlab_get_max_version_branch/actions/gitlab_get_max_version_branch_action.rb', line 8 def full_version @full_version end |
#major ⇒ Object (readonly)
Returns the value of attribute major.
8 9 10 |
# File 'lib/fastlane/plugin/gitlab_get_max_version_branch/actions/gitlab_get_max_version_branch_action.rb', line 8 def major @major end |
#minor ⇒ Object (readonly)
Returns the value of attribute minor.
8 9 10 |
# File 'lib/fastlane/plugin/gitlab_get_max_version_branch/actions/gitlab_get_max_version_branch_action.rb', line 8 def minor @minor end |
#patch ⇒ Object (readonly)
Returns the value of attribute patch.
8 9 10 |
# File 'lib/fastlane/plugin/gitlab_get_max_version_branch/actions/gitlab_get_max_version_branch_action.rb', line 8 def patch @patch end |
Instance Method Details
#<=>(other) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fastlane/plugin/gitlab_get_max_version_branch/actions/gitlab_get_max_version_branch_action.rb', line 15 def <=>(other) return nil unless other.is_a?(Version) [ @major <=> other.major, @minor <=> other.minor, @patch <=> other.patch ].detect do |num| !num.zero? end || 0 end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/fastlane/plugin/gitlab_get_max_version_branch/actions/gitlab_get_max_version_branch_action.rb', line 27 def to_s @full_version end |