Skip to content

Commit 37c8387

Browse files
committed
Backport the gem to Ruby 2.3.
This makes it possible to start using the gem in a project that aims to migrate to Ruby 2.4, but must still work with 2.3 until the migration completes.
1 parent 7b0ccd4 commit 37c8387

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
language: ruby
22
rvm:
3+
- "2.3.0"
4+
- "2.4.0"
35
- ruby-head
46
before_install: gem install bundler -v 1.11.2

test/webrick_testing.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
# frozen_string_literal: false
22
require 'timeout'
33

4+
# Backport of WEBrick::Utils::TimeoutHandler.terminate from Ruby 2.4.
5+
unless WEBrick::Utils::TimeoutHandler.respond_to? :terminate
6+
class WEBrick::Utils::TimeoutHandler
7+
def self.terminate
8+
instance.terminate
9+
end
10+
11+
def terminate
12+
TimeoutMutex.synchronize{
13+
@timeout_info.clear
14+
@watcher&.kill&.join
15+
}
16+
end
17+
end
18+
end
19+
420
module TestXMLRPC
521
module WEBrick_Testing
622
def teardown

xmlrpc.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
1818
spec.bindir = "exe"
1919
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
2020
spec.require_paths = ["lib"]
21-
spec.required_ruby_version = ">= 2.4.0dev"
21+
spec.required_ruby_version = ">= 2.3"
2222

2323
spec.add_development_dependency "bundler"
2424
spec.add_development_dependency "rake"

0 commit comments

Comments
 (0)