Module: BulkLoader::DSL::ClassMethods
- Defined in:
- lib/bulk_loader/dsl.rb
Instance Method Summary collapse
-
#bulk_loader(*args, &block) ⇒ Object
getter for
BulkLoader::ClassAttributeIf you pass name, mapping, options argument, you can define loader if you does not want to export name to object, pass export: false to options.
Instance Method Details
#bulk_loader(*args, &block) ⇒ Object
getter for BulkLoader::ClassAttribute If you pass name, mapping, options argument, you can define loader if you does not want to export name to object, pass export: false to options.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/bulk_loader/dsl.rb', line 9 def bulk_loader(*args, &block) @bulk_loader ||= if superclass.respond_to?(:bulk_loader) superclass.bulk_loader.dup else BulkLoader::ClassAttribute.new end return @bulk_loader if args.empty? name, mapping, = *args ||= {} does_export = .delete(:export) does_autoload = .delete(:autoload) does_autoload = true if does_autoload.nil? loader = BulkLoader::Loader.new(mapping, , &block) @bulk_loader.define_loader(name, loader, autoload: does_autoload) return if does_export == false define_method name do bulk_loader.public_send(name) end end |