Class: Dependabot::Opentofu::Version
- Inherits:
-
Version
- Object
- Version
- Dependabot::Opentofu::Version
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/opentofu/version.rb
Class Method Summary collapse
- .correct?(version) ⇒ Boolean
- .new(version) ⇒ Object
- .remove_backport(version) ⇒ Object
- .remove_leading_v(version) ⇒ Object
Instance Method Summary collapse
-
#initialize(version) ⇒ Version
constructor
A new instance of Version.
- #to_s ⇒ Object
Constructor Details
#initialize(version) ⇒ Version
Returns a new instance of Version.
15 16 17 18 19 20 21 |
# File 'lib/dependabot/opentofu/version.rb', line 15 def initialize(version) @version_string = T.let(version.to_s, String) version = Version.remove_leading_v(version) version = Version.remove_backport(version) super end |
Class Method Details
.correct?(version) ⇒ Boolean
34 35 36 37 38 39 40 41 |
# File 'lib/dependabot/opentofu/version.rb', line 34 def self.correct?(version) version = Version.remove_leading_v(version) version = Version.remove_backport(version) return false if version.to_s.strip.empty? super end |
.new(version) ⇒ Object
24 25 26 |
# File 'lib/dependabot/opentofu/version.rb', line 24 def self.new(version) T.cast(super, Dependabot::Opentofu::Version) end |
.remove_backport(version) ⇒ Object
51 52 53 54 55 |
# File 'lib/dependabot/opentofu/version.rb', line 51 def self.remove_backport(version) return version.split("+").first if version.is_a?(String) && version.include?("+") version end |
.remove_leading_v(version) ⇒ Object
44 45 46 47 48 |
# File 'lib/dependabot/opentofu/version.rb', line 44 def self.remove_leading_v(version) return version.gsub(/^v/, "") if version.is_a?(String) version end |
Instance Method Details
#to_s ⇒ Object
29 30 31 |
# File 'lib/dependabot/opentofu/version.rb', line 29 def to_s @version_string end |