Class: Dependabot::Julia::Version
- Inherits:
-
Version
- Object
- Version
- Dependabot::Julia::Version
- Defined in:
- lib/dependabot/julia/version.rb
Constant Summary collapse
- VERSION_PATTERN =
Julia follows semantic versioning for most packages See: docs.julialang.org/en/v1/stdlib/Pkg/#Version-specifier-format
T.let(/^v?(\d+(?:\.\d+)*)(?:[-+].*)?$/, Regexp)
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(version) ⇒ Version
constructor
A new instance of Version.
Constructor Details
#initialize(version) ⇒ Version
Returns a new instance of Version.
22 23 24 25 26 27 28 29 30 |
# File 'lib/dependabot/julia/version.rb', line 22 def initialize(version) version_string = version.to_s.strip # Remove 'v' prefix if present (common in Julia) version_string = version_string.sub(/^v/, "") if version_string.match?(/^v\d/) @version_string = T.let(version_string, String) super(version_string) end |
Class Method Details
.correct?(version) ⇒ Boolean
14 15 16 17 18 19 |
# File 'lib/dependabot/julia/version.rb', line 14 def self.correct?(version) return false if version.nil? version_string = version.to_s VERSION_PATTERN.match?(version_string) end |
.new(version) ⇒ Object
37 38 39 |
# File 'lib/dependabot/julia/version.rb', line 37 def self.new(version) T.cast(super, Dependabot::Julia::Version) end |