mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use yield instead block argument.
This commit is contained in:
parent
fa11c60b44
commit
f0eaf11c0e
1 changed files with 4 additions and 4 deletions
|
@ -11,19 +11,19 @@ module ActiveRecord
|
||||||
repositories[current_repository_name] ||= Weakling::WeakHash.new
|
repositories[current_repository_name] ||= Weakling::WeakHash.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def with_repository(name = :default, &block)
|
def with_repository(name = :default)
|
||||||
old_repository = self.current_repository_name
|
old_repository = self.current_repository_name
|
||||||
self.current_repository_name = name
|
self.current_repository_name = name
|
||||||
|
|
||||||
block.call(current)
|
yield if block_given?
|
||||||
ensure
|
ensure
|
||||||
self.current_repository_name = old_repository
|
self.current_repository_name = old_repository
|
||||||
end
|
end
|
||||||
|
|
||||||
def without(&block)
|
def without
|
||||||
old, self.enabled = self.enabled, false
|
old, self.enabled = self.enabled, false
|
||||||
|
|
||||||
block.call
|
yield if block_given?
|
||||||
ensure
|
ensure
|
||||||
self.enabled = old
|
self.enabled = old
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue