Class Net::SSH::Version
In: lib/net/ssh/version.rb
lib/net/ssh/version.rb
Parent: Object

A class for describing the current version of a library. The version consists of three parts: the major number, the minor number, and the tiny (or patch) number.

Two Version instances may be compared, so that you can test that a version of a library is what you require:

  require 'net/ssh/version'

  if Net::SSH::Version::CURRENT < Net::SSH::Version[2,1,0]
    abort "your software is too old!"
  end

Methods

<=>   <=>   []   []   new   new   to_i   to_i   to_s   to_s  

Constants

MAJOR = 2   The major component of this version of the Net::SSH library
MINOR = 0   The minor component of this version of the Net::SSH library
TINY = 2   The tiny component of this version of the Net::SSH library
CURRENT = new(MAJOR, MINOR, TINY)   The current version of the Net::SSH library as a Version instance
STRING = CURRENT.to_s   The current version of the Net::SSH library as a String
MAJOR = 2   The major component of this version of the Net::SSH library
MINOR = 0   The minor component of this version of the Net::SSH library
TINY = 2   The tiny component of this version of the Net::SSH library
CURRENT = new(MAJOR, MINOR, TINY)   The current version of the Net::SSH library as a Version instance
STRING = CURRENT.to_s   The current version of the Net::SSH library as a String

Attributes

major  [R] 
major  [R] 
minor  [R] 
minor  [R] 
tiny  [R] 
tiny  [R] 

Public Class methods

A convenience method for instantiating a new Version instance with the given major, minor, and tiny components.

[Source]

    # File lib/net/ssh/version.rb, line 17
17:     def self.[](major, minor, tiny)
18:       new(major, minor, tiny)
19:     end

A convenience method for instantiating a new Version instance with the given major, minor, and tiny components.

[Source]

    # File lib/net/ssh/version.rb, line 17
17:     def self.[](major, minor, tiny)
18:       new(major, minor, tiny)
19:     end

Create a new Version object with the given components.

[Source]

    # File lib/net/ssh/version.rb, line 24
24:     def initialize(major, minor, tiny)
25:       @major, @minor, @tiny = major, minor, tiny
26:     end

Create a new Version object with the given components.

[Source]

    # File lib/net/ssh/version.rb, line 24
24:     def initialize(major, minor, tiny)
25:       @major, @minor, @tiny = major, minor, tiny
26:     end

Public Instance methods

Compare this version to the given version object.

[Source]

    # File lib/net/ssh/version.rb, line 29
29:     def <=>(version)
30:       to_i <=> version.to_i
31:     end

Compare this version to the given version object.

[Source]

    # File lib/net/ssh/version.rb, line 29
29:     def <=>(version)
30:       to_i <=> version.to_i
31:     end

Converts this version to a canonical integer that may be compared against other version objects.

[Source]

    # File lib/net/ssh/version.rb, line 41
41:     def to_i
42:       @to_i ||= @major * 1_000_000 + @minor * 1_000 + @tiny
43:     end

Converts this version to a canonical integer that may be compared against other version objects.

[Source]

    # File lib/net/ssh/version.rb, line 41
41:     def to_i
42:       @to_i ||= @major * 1_000_000 + @minor * 1_000 + @tiny
43:     end

Converts this version object to a string, where each of the three version components are joined by the ’.’ character. E.g., 2.0.0.

[Source]

    # File lib/net/ssh/version.rb, line 35
35:     def to_s
36:       @to_s ||= [@major, @minor, @tiny].join(".")
37:     end

Converts this version object to a string, where each of the three version components are joined by the ’.’ character. E.g., 2.0.0.

[Source]

    # File lib/net/ssh/version.rb, line 35
35:     def to_s
36:       @to_s ||= [@major, @minor, @tiny].join(".")
37:     end

[Validate]