Skip to content

Commit af42352

Browse files
committed
whitespace
1 parent 1d054eb commit af42352

File tree

2 files changed

+63
-63
lines changed

2 files changed

+63
-63
lines changed

lib/concurrent/agent.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def <<(block)
164164
# @!visibility private
165165
def try_rescue(ex) # :nodoc:
166166
rescuer = mutex.synchronize do
167-
@rescuers.find{|r| ex.is_a?(r.clazz) }
167+
@rescuers.find { |r| ex.is_a?(r.clazz) }
168168
end
169169
rescuer.block.call(ex) if rescuer
170170
rescue Exception => ex

spec/concurrent/agent_spec.rb

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ def dereferenceable_observable(opts = {})
3434
end
3535

3636
def execute_dereferenceable(subject)
37-
subject.post{|value| 10 }
37+
subject.post { |value| 10 }
3838
sleep(0.1)
3939
end
4040

4141
it_should_behave_like :dereferenceable
4242

4343
# observable
44-
45-
subject{ Agent.new(0) }
46-
44+
45+
subject { Agent.new(0) }
46+
4747
def trigger_observable(observable)
48-
observable.post{ nil }
48+
observable.post { nil }
4949
sleep(0.1)
5050
end
5151

@@ -71,25 +71,25 @@ def trigger_observable(observable)
7171
it 'uses the executor given with the :executor option' do
7272
executor.should_receive(:post).with(any_args).and_return(0)
7373
agent = Agent.new(0, executor: executor)
74-
agent.post{|value| 0 }
74+
agent.post { |value| 0 }
7575
end
7676

7777
it 'uses the global operation pool when :operation is true' do
7878
Concurrent.configuration.should_receive(:global_operation_pool).and_return(executor)
7979
agent = Agent.new(0, operation: true)
80-
agent.post{|value| 0 }
80+
agent.post { |value| 0 }
8181
end
8282

8383
it 'uses the global task pool when :task is true' do
8484
Concurrent.configuration.should_receive(:global_task_pool).and_return(executor)
8585
agent = Agent.new(0, task: true)
86-
agent.post{|value| 0 }
86+
agent.post { |value| 0 }
8787
end
8888

8989
it 'uses the global task pool by default' do
9090
Concurrent.configuration.should_receive(:global_task_pool).and_return(executor)
9191
agent = Agent.new(0)
92-
agent.post{|value| 0 }
92+
agent.post { |value| 0 }
9393
end
9494
end
9595

@@ -245,85 +245,85 @@ def trigger_observable(observable)
245245
it 'calls the first exception block with a matching class' do
246246
@expected = nil
247247
subject.
248-
rescue(StandardError) { |ex| @expected = 1 }.
249-
rescue(StandardError) { |ex| @expected = 2 }.
250-
rescue(StandardError) { |ex| @expected = 3 }
251-
subject.post { raise StandardError }
252-
sleep(0.1)
253-
@expected.should eq 1
254-
end
248+
rescue(StandardError) { |ex| @expected = 1 }.
249+
rescue(StandardError) { |ex| @expected = 2 }.
250+
rescue(StandardError) { |ex| @expected = 3 }
251+
subject.post { raise StandardError }
252+
sleep(0.1)
253+
@expected.should eq 1
254+
end
255255

256256
it 'matches all with a rescue with no class given' do
257257
@expected = nil
258258
subject.
259-
rescue(LoadError) { |ex| @expected = 1 }.
260-
rescue { |ex| @expected = 2 }.
261-
rescue(StandardError) { |ex| @expected = 3 }
262-
subject.post { raise NoMethodError }
263-
sleep(0.1)
264-
@expected.should eq 2
265-
end
259+
rescue(LoadError) { |ex| @expected = 1 }.
260+
rescue { |ex| @expected = 2 }.
261+
rescue(StandardError) { |ex| @expected = 3 }
262+
subject.post { raise NoMethodError }
263+
sleep(0.1)
264+
@expected.should eq 2
265+
end
266266

267267
it 'searches associated rescue handlers in order' do
268268
@expected = nil
269269
subject.
270-
rescue(ArgumentError) { |ex| @expected = 1 }.
271-
rescue(LoadError) { |ex| @expected = 2 }.
272-
rescue(StandardError) { |ex| @expected = 3 }
273-
subject.post { raise ArgumentError }
274-
sleep(0.1)
275-
@expected.should eq 1
270+
rescue(ArgumentError) { |ex| @expected = 1 }.
271+
rescue(LoadError) { |ex| @expected = 2 }.
272+
rescue(StandardError) { |ex| @expected = 3 }
273+
subject.post { raise ArgumentError }
274+
sleep(0.1)
275+
@expected.should eq 1
276276

277-
@expected = nil
278-
subject.
279-
rescue(ArgumentError) { |ex| @expected = 1 }.
280-
rescue(LoadError) { |ex| @expected = 2 }.
281-
rescue(StandardError) { |ex| @expected = 3 }
282-
subject.post { raise LoadError }
283-
sleep(0.1)
284-
@expected.should eq 2
285-
286-
@expected = nil
287-
subject.
288-
rescue(ArgumentError) { |ex| @expected = 1 }.
277+
@expected = nil
278+
subject.
279+
rescue(ArgumentError) { |ex| @expected = 1 }.
289280
rescue(LoadError) { |ex| @expected = 2 }.
290281
rescue(StandardError) { |ex| @expected = 3 }
291-
subject.post { raise StandardError }
292-
sleep(0.1)
293-
@expected.should eq 3
294-
end
282+
subject.post { raise LoadError }
283+
sleep(0.1)
284+
@expected.should eq 2
285+
286+
@expected = nil
287+
subject.
288+
rescue(ArgumentError) { |ex| @expected = 1 }.
289+
rescue(LoadError) { |ex| @expected = 2 }.
290+
rescue(StandardError) { |ex| @expected = 3 }
291+
subject.post { raise StandardError }
292+
sleep(0.1)
293+
@expected.should eq 3
294+
end
295295

296296
it 'passes the exception object to the matched block' do
297297
@expected = nil
298298
subject.
299-
rescue(ArgumentError) { |ex| @expected = ex }.
300-
rescue(LoadError) { |ex| @expected = ex }.
301-
rescue(StandardError) { |ex| @expected = ex }
302-
subject.post { raise StandardError }
303-
sleep(0.1)
304-
@expected.should be_a(StandardError)
305-
end
299+
rescue(ArgumentError) { |ex| @expected = ex }.
300+
rescue(LoadError) { |ex| @expected = ex }.
301+
rescue(StandardError) { |ex| @expected = ex }
302+
subject.post { raise StandardError }
303+
sleep(0.1)
304+
@expected.should be_a(StandardError)
305+
end
306306

307307
it 'ignores rescuers without a block' do
308308
@expected = nil
309309
subject.
310-
rescue(StandardError).
311-
rescue(StandardError) { |ex| @expected = ex }
312-
subject.post { raise StandardError }
313-
sleep(0.1)
314-
@expected.should be_a(StandardError)
315-
end
310+
rescue(StandardError).
311+
rescue(StandardError) { |ex| @expected = ex }
312+
subject.post { raise StandardError }
313+
sleep(0.1)
314+
@expected.should be_a(StandardError)
315+
end
316316

317317
it 'supresses the exception if no rescue matches' do
318318
lambda {
319319
subject.
320-
rescue(ArgumentError) { |ex| @expected = ex }.
321-
rescue(NotImplementedError) { |ex| @expected = ex }.
322-
rescue(NoMethodError) { |ex| @expected = ex }
320+
rescue(ArgumentError) { |ex| @expected = ex }.
321+
rescue(NotImplementedError) { |ex| @expected = ex }.
322+
rescue(NoMethodError) { |ex| @expected = ex }
323323
subject.post { raise StandardError }
324324
sleep(0.1)
325325
}.should_not raise_error
326-
end
326+
end
327327

328328
it 'suppresses exceptions thrown from rescue handlers' do
329329
lambda {

0 commit comments

Comments
 (0)