Skip to content

Commit c192d07

Browse files
committed
Fix up a variety of Ruby warnings
1 parent d094e15 commit c192d07

File tree

10 files changed

+13
-15
lines changed

10 files changed

+13
-15
lines changed

lib/concurrent/async.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ def method_missing(method, *args, &block)
8181
super unless @delegate.respond_to?(method)
8282
Async::validate_argc(@delegate, method, *args)
8383

84-
self.define_singleton_method(method) do |*args|
85-
Async::validate_argc(@delegate, method, *args)
84+
self.define_singleton_method(method) do |*args2|
85+
Async::validate_argc(@delegate, method, *args2)
8686
ivar = Concurrent::IVar.new
8787
value, reason = nil, nil
8888
@serializer.post(@executor.value) do
8989
begin
90-
value = @delegate.send(method, *args, &block)
90+
value = @delegate.send(method, *args2, &block)
9191
rescue => reason
9292
# caught
9393
ensure

lib/concurrent/atomic/atomic_fixnum.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ module Concurrent
2525
class MutexAtomicFixnum
2626

2727
# http://stackoverflow.com/questions/535721/ruby-max-integer
28-
MIN_VALUE = -(2**(0.size * 8 -2))
29-
MAX_VALUE = (2**(0.size * 8 -2) -1)
28+
MIN_VALUE = -(2**(0.size * 8 - 2))
29+
MAX_VALUE = (2**(0.size * 8 - 2) - 1)
3030

3131
# @!macro [attach] atomic_fixnum_method_initialize
3232
#

lib/concurrent/executor/indirect_immediate_executor.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def post(*args, &task)
2828
return false unless running?
2929

3030
event = Concurrent::Event.new
31-
internal_executor.post do
31+
@internal_executor.post do
3232
begin
3333
task.call(*args)
3434
ensure
@@ -39,8 +39,5 @@ def post(*args, &task)
3939

4040
true
4141
end
42-
43-
private
44-
attr_reader :internal_executor
4542
end
4643
end

lib/concurrent/executor/ruby_thread_pool_worker.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def initialize(queue, parent)
1313
@parent = parent
1414
@mutex = Mutex.new
1515
@last_activity = Time.now.to_f
16+
@thread = nil
1617
end
1718

1819
# @!visibility private

lib/concurrent/executor/serialized_execution.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class SerializedExecution
1212

1313
Job = Struct.new(:executor, :args, :block) do
1414
def call
15-
block.call *args
15+
block.call(*args)
1616
end
1717
end
1818

lib/concurrent/lazy_register.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def register(key, &block)
4949
# @return self
5050
# @param [Object] key
5151
def unregister(key)
52-
@data.update { |h| h.dup.tap { |h| h.delete(key) } }
52+
@data.update { |h| h.dup.tap { |j| j.delete(key) } }
5353
self
5454
end
5555

lib/concurrent/observable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def add_observer(*args, &block)
4646
# as #add_observer but it can be used for chaining
4747
# @return [Observable] self
4848
def with_observer(*args, &block)
49-
add_observer *args, &block
49+
add_observer(*args, &block)
5050
self
5151
end
5252

lib/concurrent/promise.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def then(rescuer = nil, &block)
100100
# @return [Promise]
101101
def on_success(&block)
102102
raise ArgumentError.new('no block given') unless block_given?
103-
self.then &block
103+
self.then(&block)
104104
end
105105

106106
# @return [Promise]

lib/concurrent/scheduled_task.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def initialize(intended_time, opts = {}, &block)
2626
def execute
2727
if compare_and_set_state(:pending, :unscheduled)
2828
@schedule_time = TimerSet.calculate_schedule_time(@intended_time)
29-
Concurrent::timer(@schedule_time.to_f - Time.now.to_f) { @executor.post &method(:process_task) }
29+
Concurrent::timer(@schedule_time.to_f - Time.now.to_f) { @executor.post(&method(:process_task)) }
3030
self
3131
end
3232
end

lib/concurrent/timer_task.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def schedule_next_task(interval = execution_interval)
317317
def execute_task(completion)
318318
return unless @running.true?
319319
Concurrent::timer(execution_interval, completion, &method(:timeout_task))
320-
success, value, reason = @executor.execute(self)
320+
_success, value, reason = @executor.execute(self)
321321
if completion.try?
322322
self.value = value
323323
schedule_next_task

0 commit comments

Comments
 (0)