Class: Dependabot::GithubActions::Version

Inherits:
Version
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/github_actions/version.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ Version

Returns a new instance of Version.



15
16
17
18
# File 'lib/dependabot/github_actions/version.rb', line 15

def initialize(version)
  version = Version.remove_leading_v(version)
  super
end

Class Method Details

.correct?(version) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
36
37
38
# File 'lib/dependabot/github_actions/version.rb', line 33

def self.correct?(version)
  return false if version.to_s.strip.empty?

  version = Version.remove_leading_v(version)
  super
end

.new(version) ⇒ Object



21
22
23
# File 'lib/dependabot/github_actions/version.rb', line 21

def self.new(version)
  T.cast(super, Dependabot::GithubActions::Version)
end

.remove_leading_v(version) ⇒ Object



26
27
28
29
30
# File 'lib/dependabot/github_actions/version.rb', line 26

def self.remove_leading_v(version)
  return version unless version.to_s.match?(/\Av([0-9])/)

  version.to_s.delete_prefix("v")
end