lib/ronin/auto_load.rb in ronin-1.4.1 vs lib/ronin/auto_load.rb in ronin-1.5.0.rc1
- old
+ new
@@ -32,10 +32,31 @@
base.send :include, OpenNamespace
base.send :extend, ClassMethods
end
module ClassMethods
- protected
+ #
+ # Requires the file that should contain the constant.
+ #
+ # @param [String, Symbol] name
+ # The name of the constant.
+ #
+ # @return [Class, Module, nil]
+ # The loaded constant.
+ #
+ # @since 1.5.0
+ #
+ # @api public
+ #
+ def require_const(name)
+ const = super(name)
+
+ if (const && const < DataMapper::Resource)
+ const.finalize
+ end
+
+ return const
+ end
#
# Transparently auto-loads Classes and Modules from their respective
# files using [OpenNamespace](http://rubydoc.info/gems/open_namespace).
#