Module: NoBrainer::Autoload
- Includes:
- ActiveSupport::Autoload
- Included in:
- NoBrainer, Criteria, Document, Document::Association, Document::Index, Document::PrimaryKey, Document::TableConfig, Document::Validation, Document::VirtualAttributes, Geo, QueryRunner, System
- Defined in:
- lib/no_brainer/autoload.rb
Class Method Summary collapse
Instance Method Summary collapse
- #autoload(*constants) ⇒ Object
- #autoload_and_include(*constants) ⇒ Object
- #eager_autoload(*constants) ⇒ Object
- #eager_load! ⇒ Object
Class Method Details
.extended(base) ⇒ Object
4 5 6 |
# File 'lib/no_brainer/autoload.rb', line 4 def self.extended(base) ActiveSupport::Autoload.send(:extended, base) end |
Instance Method Details
#autoload(*constants) ⇒ Object
8 9 10 |
# File 'lib/no_brainer/autoload.rb', line 8 def autoload(*constants) constants.each { |constant| super(constant) } end |
#autoload_and_include(*constants) ⇒ Object
22 23 24 25 |
# File 'lib/no_brainer/autoload.rb', line 22 def autoload_and_include(*constants) eager_autoload(*constants) constants.each { |constant| include const_get(constant) } end |
#eager_autoload(*constants) ⇒ Object
12 13 14 |
# File 'lib/no_brainer/autoload.rb', line 12 def eager_autoload(*constants) super() { autoload(*constants) } end |
#eager_load! ⇒ Object
16 17 18 19 20 |
# File 'lib/no_brainer/autoload.rb', line 16 def eager_load! super @_autoloads.keys.map { |c| const_get(c) } .each { |c| c.eager_load! if c.respond_to?(:eager_load!) } end |