Cleanup dead code for Ruby < 2.2
This commit is contained in:
parent
8ffa7bbb75
commit
414f800214
2
Gemfile
2
Gemfile
|
@ -12,7 +12,7 @@ gem 'concurrent-ruby-edge', Concurrent::EDGE_VERSION, options
|
|||
gem 'concurrent-ruby-ext', Concurrent::VERSION, options.merge(platform: :mri)
|
||||
|
||||
group :development do
|
||||
gem 'rake', (Concurrent.ruby_version :<, 2, 2, 0) ? '~> 12.0' : '~> 13.0'
|
||||
gem 'rake', '~> 13.0'
|
||||
gem 'rake-compiler', '~> 1.0', '>= 1.0.7'
|
||||
gem 'rake-compiler-dock', '~> 1.0'
|
||||
gem 'pry', '~> 0.11', platforms: :mri
|
||||
|
|
9
Rakefile
9
Rakefile
|
@ -2,15 +2,6 @@ require_relative 'lib/concurrent-ruby/concurrent/version'
|
|||
require_relative 'lib/concurrent-ruby-edge/concurrent/edge/version'
|
||||
require_relative 'lib/concurrent-ruby/concurrent/utility/engine'
|
||||
|
||||
if Concurrent.ruby_version :<, 2, 0, 0
|
||||
# @!visibility private
|
||||
module Kernel
|
||||
def __dir__
|
||||
File.dirname __FILE__
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
core_gemspec = Gem::Specification.load File.join(__dir__, 'concurrent-ruby.gemspec')
|
||||
ext_gemspec = Gem::Specification.load File.join(__dir__, 'concurrent-ruby-ext.gemspec')
|
||||
edge_gemspec = Gem::Specification.load File.join(__dir__, 'concurrent-ruby-edge.gemspec')
|
||||
|
|
|
@ -6,7 +6,7 @@ require 'concurrent/actor'
|
|||
require 'concurrent/agent'
|
||||
require 'concurrent/channel'
|
||||
require 'concurrent/lazy_register'
|
||||
require 'concurrent/executor/wrapping_executor' if Concurrent.ruby_version :>=, 2, 1, 0
|
||||
require 'concurrent/executor/wrapping_executor'
|
||||
|
||||
require 'concurrent/edge/lock_free_linked_set'
|
||||
require 'concurrent/edge/lock_free_queue'
|
||||
|
@ -16,4 +16,4 @@ require 'concurrent/edge/throttle'
|
|||
require 'concurrent/edge/channel'
|
||||
|
||||
require 'concurrent/edge/processing_actor'
|
||||
require 'concurrent/edge/erlang_actor' if Concurrent.ruby_version :>=, 2, 1, 0
|
||||
require 'concurrent/edge/erlang_actor'
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
if Concurrent.ruby_version :<, 2, 1, 0
|
||||
raise 'ErlangActor requires at least ruby version 2.1'
|
||||
end
|
||||
|
||||
module Concurrent
|
||||
|
||||
# This module provides actor abstraction that has same behaviour as Erlang actor.
|
||||
|
|
|
@ -4,9 +4,7 @@ module Concurrent
|
|||
# @!visibility private
|
||||
# @!macro internal_implementation_note
|
||||
LockableObjectImplementation = case
|
||||
when Concurrent.on_cruby? && Concurrent.ruby_version(:<=, 1, 9, 3)
|
||||
MonitorLockableObject
|
||||
when Concurrent.on_cruby? && Concurrent.ruby_version(:>, 1, 9, 3)
|
||||
when Concurrent.on_cruby?
|
||||
MutexLockableObject
|
||||
when Concurrent.on_jruby?
|
||||
JRubyLockableObject
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,48 +0,0 @@
|
|||
module Concurrent
|
||||
RSpec.describe WrappingExecutor do
|
||||
|
||||
let(:wrapping_executor) { WrappingExecutor.new(executor, &wrapper) }
|
||||
let(:executor) { Concurrent.global_fast_executor }
|
||||
let(:wrapper) { nil }
|
||||
let(:args) { { foo: 'bar', baz: 42 } }
|
||||
let(:task) { -> (*args) { return nil } }
|
||||
|
||||
subject { wrapping_executor }
|
||||
|
||||
it { is_expected.to be_kind_of(WrappingExecutor) }
|
||||
it { is_expected.to respond_to(:post) }
|
||||
it { is_expected.to respond_to(:can_overflow?) }
|
||||
it { is_expected.to respond_to(:serialized?) }
|
||||
|
||||
describe '#post' do
|
||||
context 'with passthrough wrapper' do
|
||||
let(:wrapper) { -> (*args, &task) { return *args, task } }
|
||||
|
||||
it {
|
||||
expect(executor).to receive(:post).with(args) { |&block| expect(block).to be(task) }
|
||||
wrapping_executor.post(args, &task)
|
||||
}
|
||||
end
|
||||
|
||||
context 'with wrapper modifying args' do
|
||||
let(:wrapper) { -> (*args, &task) { return *args, { xyz: 'abc' }, task } }
|
||||
|
||||
it {
|
||||
expect(executor).to receive(:post).with(args, { xyz: 'abc' }) { |&block| expect(block).to be(task) }
|
||||
wrapping_executor.post(args, &task)
|
||||
}
|
||||
end
|
||||
|
||||
context 'with wrapper modifying task' do
|
||||
let(:wrapper) { -> (*args, &task) { return *args, another_task } }
|
||||
let(:another_task) { -> (*args) { return true } }
|
||||
|
||||
it {
|
||||
expect(executor).to receive(:post).with(args) { |&block| expect(block).to be(another_task) }
|
||||
wrapping_executor.post(args, &task)
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1 +1,48 @@
|
|||
require_relative 'wrapping_executor_loaded_manualy' if Concurrent.ruby_version :>=, 2, 1, 0
|
||||
module Concurrent
|
||||
RSpec.describe WrappingExecutor do
|
||||
|
||||
let(:wrapping_executor) { WrappingExecutor.new(executor, &wrapper) }
|
||||
let(:executor) { Concurrent.global_fast_executor }
|
||||
let(:wrapper) { nil }
|
||||
let(:args) { { foo: 'bar', baz: 42 } }
|
||||
let(:task) { -> (*args) { return nil } }
|
||||
|
||||
subject { wrapping_executor }
|
||||
|
||||
it { is_expected.to be_kind_of(WrappingExecutor) }
|
||||
it { is_expected.to respond_to(:post) }
|
||||
it { is_expected.to respond_to(:can_overflow?) }
|
||||
it { is_expected.to respond_to(:serialized?) }
|
||||
|
||||
describe '#post' do
|
||||
context 'with passthrough wrapper' do
|
||||
let(:wrapper) { -> (*args, &task) { return *args, task } }
|
||||
|
||||
it {
|
||||
expect(executor).to receive(:post).with(args) { |&block| expect(block).to be(task) }
|
||||
wrapping_executor.post(args, &task)
|
||||
}
|
||||
end
|
||||
|
||||
context 'with wrapper modifying args' do
|
||||
let(:wrapper) { -> (*args, &task) { return *args, { xyz: 'abc' }, task } }
|
||||
|
||||
it {
|
||||
expect(executor).to receive(:post).with(args, { xyz: 'abc' }) { |&block| expect(block).to be(task) }
|
||||
wrapping_executor.post(args, &task)
|
||||
}
|
||||
end
|
||||
|
||||
context 'with wrapper modifying task' do
|
||||
let(:wrapper) { -> (*args, &task) { return *args, another_task } }
|
||||
let(:another_task) { -> (*args) { return true } }
|
||||
|
||||
it {
|
||||
expect(executor).to receive(:post).with(args) { |&block| expect(block).to be(another_task) }
|
||||
wrapping_executor.post(args, &task)
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue