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
|
||||
end
|
||||
|
||||
def with_repository(name = :default, &block)
|
||||
def with_repository(name = :default)
|
||||
old_repository = self.current_repository_name
|
||||
self.current_repository_name = name
|
||||
|
||||
block.call(current)
|
||||
yield if block_given?
|
||||
ensure
|
||||
self.current_repository_name = old_repository
|
||||
end
|
||||
|
||||
def without(&block)
|
||||
def without
|
||||
old, self.enabled = self.enabled, false
|
||||
|
||||
block.call
|
||||
yield if block_given?
|
||||
ensure
|
||||
self.enabled = old
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue