backports 2.6.6 → 2.6.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,13 +14,15 @@ class IO
14
14
  begin
15
15
  File.open(__FILE__) { |f| IO.open(f.fileno, :mode => 'r').close }
16
16
  rescue StandardError
17
- def open_with_options_hash(fd, mode = nil, options = Backports::Undefined)
18
- mode = Backports.combine_mode_and_option(mode, options)
19
- # Can't backport autoclose, {internal|external|}encoding
17
+ def open_with_options_hash(*args)
18
+ if args.size > 2 || args[1].is_a?(Hash)
19
+ fd, mode, options = (args << Backports::Undefined)
20
+ args = [fd, Backports.combine_mode_and_option(mode, options)]
21
+ end
20
22
  if block_given?
21
- open_without_options_hash(fd, mode){|f| yield f}
23
+ open_without_options_hash(*args){|f| yield f}
22
24
  else
23
- open_without_options_hash(fd, mode)
25
+ open_without_options_hash(*args)
24
26
  end
25
27
  end
26
28
 
@@ -1,3 +1,3 @@
1
1
  module Backports
2
- VERSION = "2.6.6"
2
+ VERSION = "2.6.7"
3
3
  end
@@ -0,0 +1,9 @@
1
+ require 'test/unit'
2
+ require 'socket'
3
+ require './lib/backports'
4
+
5
+ class TestSocketInteraction < Test::Unit::TestCase
6
+ def test_interaction # Issue #67
7
+ assert_equal nil, UDPSocket.open{}
8
+ end
9
+ end
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: 2.6.6
4
+ version: 2.6.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -119,6 +119,7 @@ files:
119
119
  - test/README
120
120
  - test/std_lib_loading_test.rb
121
121
  - test/test_helper.rb
122
+ - test/test_socket_interaction.rb
122
123
  homepage: http://github.com/marcandre/backports
123
124
  licenses: []
124
125
  post_install_message:
@@ -147,4 +148,5 @@ test_files:
147
148
  - test/README
148
149
  - test/std_lib_loading_test.rb
149
150
  - test/test_helper.rb
151
+ - test/test_socket_interaction.rb
150
152
  has_rdoc: