file-temp 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES.rdoc +4 -0
- data/file-temp.gemspec +1 -1
- data/lib/file/java/temp.rb +3 -2
- data/lib/file/temp.rb +1 -1
- data/lib/file/unix/temp.rb +5 -3
- data/lib/file/windows/temp.rb +5 -3
- data/test/test_file_temp.rb +1 -1
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75e2f5bc74f512cad14b4b8c48e2d4ec6ea79f581df34bd3d98cf3867f9745e5
|
4
|
+
data.tar.gz: 731f4cbb1c1096ff23d070f06cefde7c3bc93790ad8be7e63ddbbbc5137f434c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3700145f748426eb5770c6e984f35c856c55bd12f3edc3d55fb2c41f45f198ba1925cf5c4a1a2885a92dc9b31e58444464c7d3ad6f4295f71bfd88a8d41aff68
|
7
|
+
data.tar.gz: 523dfae153d35f178178f8f36a9e14c184d2a4c65a75f7c2ce9a8f1ac42a322750506c8c775d277a46f6eeb8a317318bda09e1544fdb2e0aab21895c3007ad34
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGES.rdoc
CHANGED
data/file-temp.gemspec
CHANGED
data/lib/file/java/temp.rb
CHANGED
@@ -31,7 +31,7 @@ class File::Temp < File
|
|
31
31
|
# fh.puts 'hello world'
|
32
32
|
# fh.close
|
33
33
|
#
|
34
|
-
def initialize(delete: true, template: 'rb_file_temp_XXXXXX', directory: TMPDIR)
|
34
|
+
def initialize(delete: true, template: 'rb_file_temp_XXXXXX', directory: TMPDIR, options: {})
|
35
35
|
raise TypeError unless template.is_a?(String)
|
36
36
|
|
37
37
|
# Since Java uses a GUID extension to generate a unique file name
|
@@ -47,9 +47,10 @@ class File::Temp < File
|
|
47
47
|
end
|
48
48
|
|
49
49
|
@file.deleteOnExit if delete
|
50
|
+
options[:mode] ||= 'wb+'
|
50
51
|
|
51
52
|
path = @file.getName
|
52
|
-
super(path,
|
53
|
+
super(path, options)
|
53
54
|
|
54
55
|
@path = path unless delete
|
55
56
|
end
|
data/lib/file/temp.rb
CHANGED
data/lib/file/unix/temp.rb
CHANGED
@@ -51,7 +51,7 @@ class File::Temp < File
|
|
51
51
|
# fh.puts 'hello world'
|
52
52
|
# fh.close
|
53
53
|
#
|
54
|
-
def initialize(delete: true, template: 'rb_file_temp_XXXXXX', directory: TMPDIR)
|
54
|
+
def initialize(delete: true, template: 'rb_file_temp_XXXXXX', directory: TMPDIR, options: {})
|
55
55
|
@fptr = nil
|
56
56
|
|
57
57
|
if delete
|
@@ -74,10 +74,12 @@ class File::Temp < File
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
+
options[:mode] ||= 'wb+'
|
78
|
+
|
77
79
|
if delete
|
78
|
-
super(fd,
|
80
|
+
super(fd, options)
|
79
81
|
else
|
80
|
-
super(@path,
|
82
|
+
super(@path, options)
|
81
83
|
end
|
82
84
|
end
|
83
85
|
|
data/lib/file/windows/temp.rb
CHANGED
@@ -81,7 +81,7 @@ class File::Temp < File
|
|
81
81
|
# fh.puts 'hello world'
|
82
82
|
# fh.close
|
83
83
|
#
|
84
|
-
def initialize(delete: true, template: 'rb_file_temp_XXXXXX', directory: TMPDIR)
|
84
|
+
def initialize(delete: true, template: 'rb_file_temp_XXXXXX', directory: TMPDIR, options: {})
|
85
85
|
@fptr = nil
|
86
86
|
|
87
87
|
if delete
|
@@ -102,10 +102,12 @@ class File::Temp < File
|
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
+
options[:mode] ||= 'wb+'
|
106
|
+
|
105
107
|
if delete
|
106
|
-
super(fd,
|
108
|
+
super(fd, options)
|
107
109
|
else
|
108
|
-
super(@path,
|
110
|
+
super(@path, options)
|
109
111
|
end
|
110
112
|
end
|
111
113
|
|
data/test/test_file_temp.rb
CHANGED
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|