Skip to content

Commit

Permalink
Backport the gem to Ruby 2.3.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pwnall committed Feb 15, 2017
1 parent 7b0ccd4 commit b3410e1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: ruby
rvm:
- "2.3"
- "2.4"
- ruby-head
before_install: gem install bundler -v 1.11.2
16 changes: 16 additions & 0 deletions test/webrick_testing.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# frozen_string_literal: false
require 'timeout'

# Backport of WEBrick::Utils::TimeoutHandler.terminate from Ruby 2.4.
unless WEBrick::Utils::TimeoutHandler.respond_to? :terminate
class WEBrick::Utils::TimeoutHandler
def self.terminate
instance.terminate
end

def terminate
TimeoutMutex.synchronize{
@timeout_info.clear
@watcher&.kill&.join
}
end
end
end

module TestXMLRPC
module WEBrick_Testing
def teardown
Expand Down
2 changes: 1 addition & 1 deletion xmlrpc.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.required_ruby_version = ">= 2.4.0dev"
spec.required_ruby_version = ">= 2.3"

spec.add_development_dependency "bundler"
spec.add_development_dependency "rake"
Expand Down

0 comments on commit b3410e1

Please sign in to comment.