Method: Jetel::Modules::Module#load

Defined in:
lib/jetel/modules/module.rb

#load(global_options, options, args) ⇒ Object



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/jetel/modules/module.rb', line 107

def load(global_options, options, args)
  sources = self.class.sources
  if args.length > 0
    args = args.map(&:downcase)
    sources = sources.select do |source|
      args.index(source[:name].downcase)
    end
  end

  sources.map do |source|
    opts = global_options.merge(options)

    transformed_file = transformed_file(source, opts)

    loader = Helper.get_loader(opts['data_loader'])

    Dir.glob(transformed_file).each do |one_file|
      puts "Loading file #{one_file}"
      loader.load(self, source, one_file, opts)
    end
  end
end