Module: N1Loader::Loadable::ClassMethods
- Defined in:
- lib/n1_loader/core/loadable.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#n1_loaders ⇒ Object
50 51 52 |
# File 'lib/n1_loader/core/loadable.rb', line 50 def n1_loaders @n1_loaders ||= superclass.respond_to?(:n1_loaders) ? superclass.n1_loaders.dup : {} end |
#n1_optimized(name, loader = nil, &block) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/n1_loader/core/loadable.rb', line 54 def n1_optimized(name, loader = nil, &block) loader ||= LoaderBuilder.build(&block) n1_loaders[name] = loader define_method(name) do |reload: false, **args| n1_loader_reload(name) if reload || n1_loader(name).nil? n1_loader(name).with(**args).for(self) end end |