Class: Dependabot::Bazel::Version
- Inherits:
-
Version
- Object
- Version
- Dependabot::Bazel::Version
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/bazel/version.rb
Instance Attribute Summary collapse
-
#bcr_suffix ⇒ Object
readonly
Returns the value of attribute bcr_suffix.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(version) ⇒ Version
constructor
A new instance of Version.
- #to_s ⇒ Object
Constructor Details
#initialize(version) ⇒ Version
Returns a new instance of Version.
17 18 19 20 21 22 23 24 25 |
# File 'lib/dependabot/bazel/version.rb', line 17 def initialize(version) @version_string = T.let(version.to_s, String) @bcr_suffix = T.let(parse_bcr_suffix(@version_string), T.nilable(Integer)) # Remove the .bcr.X suffix for comparison, and strip leading 'v' if present base_version = remove_bcr_suffix(@version_string) base_version = base_version.sub(/^v/i, "") super(base_version) end |
Instance Attribute Details
#bcr_suffix ⇒ Object (readonly)
Returns the value of attribute bcr_suffix.
33 34 35 |
# File 'lib/dependabot/bazel/version.rb', line 33 def bcr_suffix @bcr_suffix end |
Instance Method Details
#<=>(other) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/dependabot/bazel/version.rb', line 36 def <=>(other) other_bazel = convert_to_bazel_version(other) return nil unless other_bazel base_comparison = super(other_bazel) return base_comparison unless base_comparison&.zero? compare_bcr_suffixes(@bcr_suffix, other_bazel.bcr_suffix) end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/dependabot/bazel/version.rb', line 28 def to_s @version_string end |