# File lib/dm-core.rb, line 172 def self.repository(name = nil) # :yields: current_context current_repository = if name raise ArgumentError, "First optional argument must be a Symbol, but was #{args.first.inspect}" unless name.is_a?(Symbol) Repository.context.detect { |r| r.name == name } || Repository.new(name) else Repository.context.last || Repository.new(Repository.default_name) end if block_given? current_repository.scope { |*block_args| yield(*block_args) } else current_repository end end