backports 1.18.1 → 1.18.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +2 -2
- data/backports.gemspec +4 -4
- data/lib/backports/1.9.2/random/implementation.rb +7 -11
- metadata +4 -9
data/VERSION.yml
CHANGED
data/backports.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{backports}
|
8
|
-
s.version = "1.18.
|
8
|
+
s.version = "1.18.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marc-Andr\303\251 Lafortune"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-10-09}
|
13
13
|
s.description = %q{ Essential backports that enable some of the really nice features of ruby 1.8.7, ruby 1.9 and rails from ruby 1.8.6 and earlier.
|
14
14
|
}
|
15
15
|
s.email = %q{github@marc-andre.ca}
|
@@ -120,7 +120,7 @@ Gem::Specification.new do |s|
|
|
120
120
|
s.rdoc_options = ["--charset=UTF-8", "--title", "Backports library", "--main", "README.rdoc", "--line-numbers", "--inline-source"]
|
121
121
|
s.require_paths = ["lib"]
|
122
122
|
s.rubyforge_project = %q{backports}
|
123
|
-
s.rubygems_version = %q{1.3.
|
123
|
+
s.rubygems_version = %q{1.3.6}
|
124
124
|
s.summary = %q{Backports of Ruby 1.8.7+ for older ruby.}
|
125
125
|
s.test_files = [
|
126
126
|
"test/array_test.rb",
|
@@ -145,7 +145,7 @@ Gem::Specification.new do |s|
|
|
145
145
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
146
146
|
s.specification_version = 3
|
147
147
|
|
148
|
-
if Gem::Version.new(Gem::
|
148
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
149
149
|
else
|
150
150
|
end
|
151
151
|
else
|
@@ -66,26 +66,22 @@ class Random
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def _rand_range(limit)
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
range
|
69
|
+
range = limit.end - limit.begin
|
70
|
+
if (!range.is_a?(Float)) && range.respond_to?(:to_int) && range = Backports.coerce_to_int(range)
|
71
|
+
range += 1 unless limit.exclude_end?
|
72
|
+
limit.begin + @mt.random_integer(range) unless range <= 0
|
73
|
+
elsif range = Backports.coerce_to(range, Float, :to_f)
|
73
74
|
if range < 0
|
74
75
|
nil
|
75
76
|
elsif limit.exclude_end?
|
76
|
-
|
77
|
+
limit.begin + @mt.random_float * range unless range <= 0
|
77
78
|
else
|
78
79
|
# cheat a bit... this will reduce the nb of random bits
|
79
80
|
loop do
|
80
81
|
r = @mt.random_float * range * 1.0001
|
81
|
-
break
|
82
|
+
break limit.begin + r unless r > range
|
82
83
|
end
|
83
84
|
end
|
84
|
-
else
|
85
|
-
from, to = [limit.begin, limit.end].map(&Backports.method(:coerce_to_int))
|
86
|
-
to += 1 unless limit.exclude_end?
|
87
|
-
range = to - from
|
88
|
-
from + @mt.random_integer(range) unless range <= 0
|
89
85
|
end
|
90
86
|
end
|
91
87
|
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backports
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 93
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 1
|
8
7
|
- 18
|
9
|
-
-
|
10
|
-
version: 1.18.
|
8
|
+
- 2
|
9
|
+
version: 1.18.2
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- "Marc-Andr\xC3\xA9 Lafortune"
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-
|
17
|
+
date: 2010-10-09 00:00:00 -04:00
|
19
18
|
default_executable:
|
20
19
|
dependencies: []
|
21
20
|
|
@@ -142,27 +141,23 @@ rdoc_options:
|
|
142
141
|
require_paths:
|
143
142
|
- lib
|
144
143
|
required_ruby_version: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
144
|
requirements:
|
147
145
|
- - ">="
|
148
146
|
- !ruby/object:Gem::Version
|
149
|
-
hash: 3
|
150
147
|
segments:
|
151
148
|
- 0
|
152
149
|
version: "0"
|
153
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
-
none: false
|
155
151
|
requirements:
|
156
152
|
- - ">="
|
157
153
|
- !ruby/object:Gem::Version
|
158
|
-
hash: 3
|
159
154
|
segments:
|
160
155
|
- 0
|
161
156
|
version: "0"
|
162
157
|
requirements: []
|
163
158
|
|
164
159
|
rubyforge_project: backports
|
165
|
-
rubygems_version: 1.3.
|
160
|
+
rubygems_version: 1.3.6
|
166
161
|
signing_key:
|
167
162
|
specification_version: 3
|
168
163
|
summary: Backports of Ruby 1.8.7+ for older ruby.
|