lib/mongoid.rb in mongoid-1.2.9 vs lib/mongoid.rb in mongoid-1.2.10

- old
+ new

@@ -44,10 +44,11 @@ require "mongoid/commands" require "mongoid/config" require "mongoid/contexts" require "mongoid/criteria" require "mongoid/cursor" +require "mongoid/deprecation" require "mongoid/extensions" require "mongoid/extras" require "mongoid/errors" require "mongoid/factory" require "mongoid/field" @@ -86,23 +87,33 @@ # # Returns: # # The Mongoid +Config+ singleton instance. def configure - config = Config.instance + config = Mongoid::Config.instance block_given? ? yield(config) : config end + # Easy convenience method for having an alert generated from the + # deprecation module. + # + # Example: + # + # <tt>Mongoid.deprecate("Method no longer used")</tt> + def deprecate(message) + Mongoid::Deprecation.instance.alert(message) + end + alias :config :configure end # Take all the public instance methods from the Config singleton and allow # them to be accessed through the Mongoid module directly. # # Example: # # <tt>Mongoid.database = Mongo::Connection.new.db("test")</tt> - Config.public_instance_methods(false).each do |name| + Mongoid::Config.public_instance_methods(false).each do |name| (class << self; self; end).class_eval <<-EOT def #{name}(*args) configure.send("#{name}", *args) end EOT