Class: Dependabot::Cargo::Version
- Inherits:
- 
      Version
      
        - Object
- Version
- Dependabot::Cargo::Version
 
- Defined in:
- lib/dependabot/cargo/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-]+(\.[0-9a-zA-Z-]+)*)?' 
- ANCHORED_VERSION_PATTERN =
- /\A\s*(#{VERSION_PATTERN})?\s*\z/
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.
| 19 20 21 22 23 24 | # File 'lib/dependabot/cargo/version.rb', line 19 def initialize(version) @version_string = version.to_s version = version.to_s.split("+").first if version.to_s.include?("+") super end | 
Class Method Details
.correct?(version) ⇒ Boolean
| 34 35 36 37 38 | # File 'lib/dependabot/cargo/version.rb', line 34 def self.correct?(version) return false if version.nil? version.to_s.match?(ANCHORED_VERSION_PATTERN) end | 
Instance Method Details
#inspect ⇒ Object
:nodoc:
| 30 31 32 | # File 'lib/dependabot/cargo/version.rb', line 30 def inspect # :nodoc: "#<#{self.class} #{@version_string}>" end | 
#to_s ⇒ Object
| 26 27 28 | # File 'lib/dependabot/cargo/version.rb', line 26 def to_s @version_string end |