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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce8a520c1d613ad4044a606a3c261c6cd385cbc23c88e51b365584a36c3b24a5
4
- data.tar.gz: 4ea26edf5dbb7b5b99defd3ebc07eba370be758dcf81b0f9cfa0aa8c2ddb186a
3
+ metadata.gz: 75e2f5bc74f512cad14b4b8c48e2d4ec6ea79f581df34bd3d98cf3867f9745e5
4
+ data.tar.gz: 731f4cbb1c1096ff23d070f06cefde7c3bc93790ad8be7e63ddbbbc5137f434c
5
5
  SHA512:
6
- metadata.gz: 94e3bb9b16f1d4ee0eb582dc8e4e58d4e1d5fab1fd5ac8659abc261a60027176b24f7c5b6dd344499dd1557ef7af594c8e0326fb62b841bf4bafeafb7dd3a7a0
7
- data.tar.gz: 9cc54ec10d6a437a4fc41cb7ac0cbbc2436f8673ffde4b5a48cff844a9a369d66df60174c3856fc060b11ef3cec10883b4168528f80b341e285ee9d920cb4b52
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
@@ -1,3 +1,7 @@
1
+ = 1.6.0 - 9-May-2020
2
+ * Added an +options+ argument that is passed along as options to the the
3
+ underlying File.new constructor.
4
+
1
5
  = 1.5.0 - 8-May-2020
2
6
  * Switched to keyword arguments.
3
7
  * Added the ability to specify a tmp directory.
data/file-temp.gemspec CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'file-temp'
5
- spec.version = '1.5.0'
5
+ spec.version = '1.6.0'
6
6
  spec.author = 'Daniel J. Berger'
7
7
  spec.license = 'Apache-2.0'
8
8
  spec.email = 'djberg96@gmail.com'
@@ -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, 'wb+')
53
+ super(path, options)
53
54
 
54
55
  @path = path unless delete
55
56
  end
data/lib/file/temp.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  class File::Temp < File
2
2
  # The version of the file-temp library
3
- VERSION = '1.5.0'.freeze
3
+ VERSION = '1.6.0'.freeze
4
4
  end
5
5
 
6
6
  if RUBY_PLATFORM == 'java'
@@ -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, 'wb+')
80
+ super(fd, options)
79
81
  else
80
- super(@path, 'wb+')
82
+ super(@path, options)
81
83
  end
82
84
  end
83
85
 
@@ -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, 'wb+')
108
+ super(fd, options)
107
109
  else
108
- super(@path, 'wb+')
110
+ super(@path, options)
109
111
  end
110
112
  end
111
113
 
@@ -22,7 +22,7 @@ class TC_File_Temp < Test::Unit::TestCase
22
22
  end
23
23
 
24
24
  test "library version is set to expected value" do
25
- assert_equal('1.5.0', File::Temp::VERSION)
25
+ assert_equal('1.6.0', File::Temp::VERSION)
26
26
  assert_true(File::Temp::VERSION.frozen?)
27
27
  end
28
28
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: file-temp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
metadata.gz.sig CHANGED
Binary file