aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/cache/file_store.rb10
-rw-r--r--activesupport/lib/active_support/evented_file_update_checker.rb8
-rw-r--r--activesupport/lib/active_support/reloader.rb8
-rw-r--r--activesupport/lib/active_support/testing/parallelization.rb42
4 files changed, 30 insertions, 38 deletions
diff --git a/activesupport/lib/active_support/cache/file_store.rb b/activesupport/lib/active_support/cache/file_store.rb
index 53a2b07536..de1fb1886c 100644
--- a/activesupport/lib/active_support/cache/file_store.rb
+++ b/activesupport/lib/active_support/cache/file_store.rb
@@ -108,12 +108,10 @@ module ActiveSupport
def lock_file(file_name, &block)
if File.exist?(file_name)
File.open(file_name, "r+") do |f|
- begin
- f.flock File::LOCK_EX
- yield
- ensure
- f.flock File::LOCK_UN
- end
+ f.flock File::LOCK_EX
+ yield
+ ensure
+ f.flock File::LOCK_UN
end
else
yield
diff --git a/activesupport/lib/active_support/evented_file_update_checker.rb b/activesupport/lib/active_support/evented_file_update_checker.rb
index 1ef8584c52..54bc5c0ae5 100644
--- a/activesupport/lib/active_support/evented_file_update_checker.rb
+++ b/activesupport/lib/active_support/evented_file_update_checker.rb
@@ -60,11 +60,9 @@ module ActiveSupport
# usage of attr_* macros for private attributes, but adds a lot of noise
# to our test suite. Thus, we lazy load it and disable warnings locally.
silence_warnings do
- begin
- require "listen"
- rescue LoadError => e
- raise LoadError, "Could not load the 'listen' gem. Add `gem 'listen'` to the development group of your Gemfile", e.backtrace
- end
+ require "listen"
+ rescue LoadError => e
+ raise LoadError, "Could not load the 'listen' gem. Add `gem 'listen'` to the development group of your Gemfile", e.backtrace
end
end
boot!
diff --git a/activesupport/lib/active_support/reloader.rb b/activesupport/lib/active_support/reloader.rb
index fea18e9712..2f81cd4f80 100644
--- a/activesupport/lib/active_support/reloader.rb
+++ b/activesupport/lib/active_support/reloader.rb
@@ -50,11 +50,9 @@ module ActiveSupport
def self.reload!
executor.wrap do
new.tap do |instance|
- begin
- instance.run!
- ensure
- instance.complete!
- end
+ instance.run!
+ ensure
+ instance.complete!
end
end
prepare!
diff --git a/activesupport/lib/active_support/testing/parallelization.rb b/activesupport/lib/active_support/testing/parallelization.rb
index c5d3a88131..63440069b1 100644
--- a/activesupport/lib/active_support/testing/parallelization.rb
+++ b/activesupport/lib/active_support/testing/parallelization.rb
@@ -69,31 +69,29 @@ module ActiveSupport
def start
@pool = @queue_size.times.map do |worker|
fork do
- begin
- DRb.stop_service
-
- after_fork(worker)
-
- queue = DRbObject.new_with_uri(@url)
-
- while job = queue.pop
- klass = job[0]
- method = job[1]
- reporter = job[2]
- result = Minitest.run_one_method(klass, method)
-
- begin
- queue.record(reporter, result)
- rescue DRb::DRbConnError
- result.failures.each do |failure|
- failure.exception = DRb::DRbRemoteError.new(failure.exception)
- end
- queue.record(reporter, result)
+ DRb.stop_service
+
+ after_fork(worker)
+
+ queue = DRbObject.new_with_uri(@url)
+
+ while job = queue.pop
+ klass = job[0]
+ method = job[1]
+ reporter = job[2]
+ result = Minitest.run_one_method(klass, method)
+
+ begin
+ queue.record(reporter, result)
+ rescue DRb::DRbConnError
+ result.failures.each do |failure|
+ failure.exception = DRb::DRbRemoteError.new(failure.exception)
end
+ queue.record(reporter, result)
end
- ensure
- run_cleanup(worker)
end
+ ensure
+ run_cleanup(worker)
end
end
end