Class: Dependabot::Version
- Inherits:
-
Gem::Version
- Object
- Gem::Version
- Dependabot::Version
- Extended by:
- T::Helpers, T::Sig
- Defined in:
- lib/dependabot/version.rb
Constant Summary collapse
- VersionParameter =
T.type_alias { T.nilable(T.any(String, Integer, Gem::Version)) }
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(version) ⇒ Version
constructor
A new instance of Version.
- #to_semver ⇒ Object
Constructor Details
#initialize(version) ⇒ Version
Returns a new instance of Version.
16 17 18 19 20 |
# File 'lib/dependabot/version.rb', line 16 def initialize(version) @original_version = T.let(version.to_s, String) super end |
Class Method Details
.correct?(version) ⇒ Boolean
29 30 31 32 33 |
# File 'lib/dependabot/version.rb', line 29 def self.correct?(version) return false if version.nil? version.to_s.match?(ANCHORED_VERSION_PATTERN) end |
.new(version) ⇒ Object
23 24 25 |
# File 'lib/dependabot/version.rb', line 23 def self.new(version) T.cast(super, Dependabot::Version) end |
Instance Method Details
#to_semver ⇒ Object
36 37 38 |
# File 'lib/dependabot/version.rb', line 36 def to_semver @original_version end |