ruby-backports 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/lib/backports/dir.rb +6 -4
- data/lib/backports/tempfile.rb +13 -11
- data/lib/backports/version.rb +1 -1
- metadata +1 -1
data/README
CHANGED
data/lib/backports/dir.rb
CHANGED
@@ -3,11 +3,13 @@ class Dir
|
|
3
3
|
class << self
|
4
4
|
|
5
5
|
if RUBY_RELEASE_DATE < '2007-02-15'
|
6
|
-
|
6
|
+
unless method_defined?(:_backports_original_brackets)
|
7
|
+
alias_method :_backports_original_brackets, :[]
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
# r11748 -- can now take many patterns
|
10
|
+
def [](*args)
|
11
|
+
args.map { |arg| _backports_original_brackets(arg) }.flatten
|
12
|
+
end
|
11
13
|
end
|
12
14
|
end
|
13
15
|
|
data/lib/backports/tempfile.rb
CHANGED
@@ -3,19 +3,21 @@ require 'tempfile'
|
|
3
3
|
class Tempfile
|
4
4
|
|
5
5
|
if RUBY_RELEASE_DATE < '2007-10-05'
|
6
|
-
|
6
|
+
unless method_defined?(:_backports_original_make_tmpname)
|
7
|
+
alias_method :_backports_original_make_tmpname, :make_tmpname
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
# r13631 -- Allow to specify a suffix for a temporary file name. Make
|
10
|
+
# temporary file names less predictable by including a random string.
|
11
|
+
def make_tmpname(basename, name)
|
12
|
+
case basename
|
13
|
+
when Array
|
14
|
+
prefix, suffix = *basename
|
15
|
+
else
|
16
|
+
prefix, suffix = basename, ''
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
+
"#{prefix}#{Time.now.strftime('%Y%m%d')}-#{$$}-#{rand(0x100000000).to_s(36)}-#{name}#{suffix}"
|
20
|
+
end
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
data/lib/backports/version.rb
CHANGED