Class: Dependabot::Deno::Version
- Inherits:
-
Version
- Object
- Version
- Dependabot::Deno::Version
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/deno/version.rb
Constant Summary collapse
- VERSION_PATTERN =
T.let(Gem::Version::VERSION_PATTERN + '(\+[0-9a-zA-Z\-.]+)?', String)
- ANCHORED_VERSION_PATTERN =
/\A\s*(#{VERSION_PATTERN})?\s*\z/
Instance Attribute Summary collapse
-
#build_info ⇒ Object
readonly
Returns the value of attribute build_info.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(version) ⇒ Version
constructor
A new instance of Version.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(version) ⇒ Version
Returns a new instance of Version.
30 31 32 33 34 35 36 37 |
# File 'lib/dependabot/deno/version.rb', line 30 def initialize(version) @version_string = T.let(version.to_s, String) @build_info = T.let(nil, T.nilable(String)) version, @build_info = version.to_s.split("+") if version.to_s.include?("+") super(T.must(version)) end |
Instance Attribute Details
#build_info ⇒ Object (readonly)
Returns the value of attribute build_info.
20 21 22 |
# File 'lib/dependabot/deno/version.rb', line 20 def build_info @build_info end |
Class Method Details
.correct?(version) ⇒ Boolean
23 24 25 26 27 |
# File 'lib/dependabot/deno/version.rb', line 23 def self.correct?(version) return false if version.nil? version.to_s.match?(ANCHORED_VERSION_PATTERN) end |
.new(version) ⇒ Object
40 41 42 |
# File 'lib/dependabot/deno/version.rb', line 40 def self.new(version) T.cast(super, Dependabot::Deno::Version) end |
Instance Method Details
#inspect ⇒ Object
50 51 52 |
# File 'lib/dependabot/deno/version.rb', line 50 def inspect "#<#{self.class} #{@version_string}>" end |
#to_s ⇒ Object
45 46 47 |
# File 'lib/dependabot/deno/version.rb', line 45 def to_s @version_string end |