Skip to content

Commit 128b266

Browse files
author
NetSHH Robot
committed
bump version
1 parent 9477908 commit 128b266

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

lib/net/scp/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def to_i
5656

5757
# The prerelease component of this version of the Net::SSH library
5858
# nil allowed
59-
PRE = "rc1"
59+
PRE = "rc2"
6060

6161
# The current version of the Net::SSH library as a Version instance
6262
CURRENT = new(*[MAJOR, MINOR, TINY, PRE].compact)

lib/net/scp/version.rb.old

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
module Net
2+
class SCP
3+
# A class for describing the current version of a library. The version
4+
# consists of three parts: the +major+ number, the +minor+ number, and the
5+
# +tiny+ (or +patch+) number.
6+
#
7+
# Two Version instances may be compared, so that you can test that a version
8+
# of a library is what you require:
9+
#
10+
# require 'net/scp/version'
11+
#
12+
# if Net::SCP::Version::CURRENT < Net::SCP::Version[2,1,0]
13+
# abort "your software is too old!"
14+
# end
15+
class Version
16+
include Comparable
17+
18+
# A convenience method for instantiating a new Version instance with the
19+
# given +major+, +minor+, and +tiny+ components.
20+
def self.[](major, minor, tiny, pre = nil)
21+
new(major, minor, tiny, pre)
22+
end
23+
24+
attr_reader :major, :minor, :tiny
25+
26+
# Create a new Version object with the given components.
27+
def initialize(major, minor, tiny, pre = nil)
28+
@major, @minor, @tiny, @pre = major, minor, tiny, pre
29+
end
30+
31+
# Compare this version to the given +version+ object.
32+
def <=>(version)
33+
to_i <=> version.to_i
34+
end
35+
36+
# Converts this version object to a string, where each of the three
37+
# version components are joined by the '.' character. E.g., 2.0.0.
38+
def to_s
39+
@to_s ||= [@major, @minor, @tiny, @pre].compact.join(".")
40+
end
41+
42+
# Converts this version to a canonical integer that may be compared
43+
# against other version objects.
44+
def to_i
45+
@to_i ||= @major * 1_000_000 + @minor * 1_000 + @tiny
46+
end
47+
48+
# The major component of this version of the Net::SSH library
49+
MAJOR = 4
50+
51+
# The minor component of this version of the Net::SSH library
52+
MINOR = 0
53+
54+
# The tiny component of this version of the Net::SSH library
55+
TINY = 1
56+
57+
# The prerelease component of this version of the Net::SSH library
58+
# nil allowed
59+
PRE = "rc1"
60+
61+
# The current version of the Net::SSH library as a Version instance
62+
CURRENT = new(*[MAJOR, MINOR, TINY, PRE].compact)
63+
64+
# The current version of the Net::SSH library as a String
65+
STRING = CURRENT.to_s
66+
end
67+
end
68+
end

0 commit comments

Comments
 (0)