Class: Dependabot::GoModules::Version
- Inherits:
-
Gem::Version
- Object
- Gem::Version
- Dependabot::GoModules::Version
- Defined in:
- lib/dependabot/go_modules/version.rb
Constant Summary collapse
- VERSION_PATTERN =
'[0-9]+[0-9a-zA-Z]*(?>\.[0-9a-zA-Z]+)*' \ '(-[0-9A-Za-z-]+(\.[0-9a-zA-Z-]+)*)?' \ '(\+incompatible)?'
- ANCHORED_VERSION_PATTERN =
/\A\s*(#{VERSION_PATTERN})?\s*\z/.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(version) ⇒ Version
constructor
A new instance of Version.
-
#inspect ⇒ Object
:nodoc:.
- #to_s ⇒ Object
Constructor Details
#initialize(version) ⇒ Version
Returns a new instance of Version.
25 26 27 28 29 30 31 |
# File 'lib/dependabot/go_modules/version.rb', line 25 def initialize(version) @version_string = version.to_s.gsub(/^v/, "") version = version.gsub(/^v/, "") if version.is_a?(String) version = version.to_s.split("+").first if version.to_s.include?("+") super end |
Class Method Details
.correct?(version) ⇒ Boolean
18 19 20 21 22 23 |
# File 'lib/dependabot/go_modules/version.rb', line 18 def self.correct?(version) version = version.gsub(/^v/, "") if version.is_a?(String) version = version.to_s.split("+").first if version.to_s.include?("+") super(version) end |
Instance Method Details
#inspect ⇒ Object
:nodoc:
33 34 35 |
# File 'lib/dependabot/go_modules/version.rb', line 33 def inspect # :nodoc: "#<#{self.class} #{@version_string.inspect}>" end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/dependabot/go_modules/version.rb', line 37 def to_s @version_string end |