struct Semver

Included Modules

Defined in:

semver.cr
version.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

Constructor Detail

def self.new(major : Int32, minor : Int32, patch : Int32, prerelease : Nil | String, build : Nil | String, string : Nil | String = nil) #

[View source]

Class Method Detail

def self.parse(string) #

[View source]

Instance Method Detail

def <=>(other : Semver) #

[View source]
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]

[View source]
def build : String | Nil #

[View source]
def build=(v : Nil | String) #

[View source]
def major : Int32 #

[View source]
def major! #

[View source]
def major=(v : Int32) #

[View source]
def minor : Int32 #

[View source]
def minor! #

[View source]
def minor=(v : Int32) #

[View source]
def patch : Int32 #

[View source]
def patch! #

[View source]
def patch=(v : Int32) #

[View source]
def prerelease : String | Nil #

[View source]
def prerelease=(v : Nil | String) #

[View source]
def prerelease_components #

[View source]
def short_string #

[View source]
def string #

[View source]
def to_s(io : IO) #
Description copied from struct Struct

Same as #inspect(io).


[View source]