backports 1.12.0 → 1.12.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +2 -1
- data/backports.gemspec +2 -2
- data/lib/backports/1.8.7/array.rb +3 -3
- data/lib/backports/1.8.7/dir.rb +1 -1
- metadata +2 -2
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.12.
|
8
|
+
s.version = "1.12.1"
|
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{2009-12-
|
12
|
+
s.date = %q{2009-12-17}
|
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}
|
@@ -136,13 +136,13 @@ class Array
|
|
136
136
|
# Standard in Ruby 1.8.7+. See official documentation[http://ruby-doc.org/core-1.9/classes/Array.html]
|
137
137
|
# Note: was named #choice in 1.8.7 and renamed in later versions
|
138
138
|
def sample(n = Backports::Undefined)
|
139
|
-
return self[rand(size)] if n == Backports::Undefined
|
139
|
+
return self[Kernel.rand(size)] if n == Backports::Undefined
|
140
140
|
n = Backports.coerce_to(n, Fixnum, :to_int)
|
141
141
|
raise ArgumentError, "negative array size" if n < 0
|
142
142
|
n = size if n > size
|
143
143
|
result = Array.new(self)
|
144
144
|
n.times do |i|
|
145
|
-
r = i + rand(size - i)
|
145
|
+
r = i + Kernel.rand(size - i)
|
146
146
|
result[i], result[r] = result[r], result[i]
|
147
147
|
end
|
148
148
|
result[n..size] = []
|
@@ -168,7 +168,7 @@ class Array
|
|
168
168
|
# Standard in Ruby 1.8.7+. See official documentation[http://ruby-doc.org/core-1.9/classes/Array.html]
|
169
169
|
def shuffle!
|
170
170
|
size.times do |i|
|
171
|
-
r = i + rand(size - i)
|
171
|
+
r = i + Kernel.rand(size - i)
|
172
172
|
self[i], self[r] = self[r], self[i]
|
173
173
|
end
|
174
174
|
self
|
data/lib/backports/1.8.7/dir.rb
CHANGED
@@ -23,7 +23,7 @@ class Dir
|
|
23
23
|
t = Time.now.strftime("%Y%m%d")
|
24
24
|
n = nil
|
25
25
|
begin
|
26
|
-
path = "#{tmpdir}/#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
|
26
|
+
path = "#{tmpdir}/#{prefix}#{t}-#{$$}-#{Kernel.rand(0x100000000).to_s(36)}"
|
27
27
|
path << "-#{n}" if n
|
28
28
|
path << suffix
|
29
29
|
Dir.mkdir(path, 0700)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backports
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.12.
|
4
|
+
version: 1.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Marc-Andr\xC3\xA9 Lafortune"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-17 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|