tempfile_for 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tempfile_for/tempfile.rb +4 -4
- data/lib/tempfile_for/version.rb +1 -1
- metadata +1 -1
@@ -8,9 +8,7 @@ module TempfileFor
|
|
8
8
|
|
9
9
|
tempfile = self.class.open("tempfile", :encoding => encoding)
|
10
10
|
|
11
|
-
File.open
|
12
|
-
tempfile.write_ext stream
|
13
|
-
end
|
11
|
+
File.open(path, :encoding => encoding) { |stream| tempfile.write_ext stream }
|
14
12
|
|
15
13
|
tempfile.rewind
|
16
14
|
tempfile
|
@@ -18,7 +16,9 @@ module TempfileFor
|
|
18
16
|
|
19
17
|
def write_ext(io_or_data)
|
20
18
|
if io_or_data.respond_to?(:read)
|
21
|
-
|
19
|
+
while data = io_or_data.read(1024)
|
20
|
+
write data
|
21
|
+
end
|
22
22
|
else
|
23
23
|
write io_or_data
|
24
24
|
end
|
data/lib/tempfile_for/version.rb
CHANGED