struct Semver
- Semver
- Struct
- Value
- Object
Included Modules
- Comparable(String)
- Comparable(Semver)
Defined in:
semver.crversion.cr
Constant Summary
- 
        PATTERN = /^(\d+)(?:\.(\d+)(?:\.(\d+))?)?(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z.-]+))?$/
- 
        VERSION = "0.2.1"
Constructors
Class Method Summary
Instance Method Summary
- #<=>(other : Semver)
- 
        #<=>(s : String)
        
          The comparison operator. 
- #build : String | Nil
- #build=(v : Nil | String)
- #major : Int32
- #major!
- #major=(v : Int32)
- #minor : Int32
- #minor!
- #minor=(v : Int32)
- #patch : Int32
- #patch!
- #patch=(v : Int32)
- #prerelease : String | Nil
- #prerelease=(v : Nil | String)
- #prerelease_components
- #short_string
- #string
- 
        #to_s(io : IO)
        
          Same as #inspect(io).
Constructor Detail
        
        def self.new(major : Int32, minor : Int32, patch : Int32, prerelease : Nil | String, build : Nil | String, string : Nil | String = nil)
        #
      
      
      Class Method Detail
Instance Method Detail
        
        def <=>(s : String)
        #
      
      
        
              Description copied from module Comparable(String)
            
          
          The comparison operator. Returns 0 if the two objects are equal,
a negative number if this object is considered less than other,
a positive number if this object is considered greater than other,
or nil if the two objects are not comparable.
Subclasses define this method to provide class-specific ordering.
The comparison operator is usually used to sort values:
# Sort in a descending way:
[3, 1, 2].sort { |x, y| y <=> x } # => [3, 2, 1]
# Sort in an ascending way:
[3, 1, 2].sort { |x, y| x <=> y } # => [1, 2, 3]