module DataImp::Finders

Public Class Methods

extended(mod) click to toggle source
# File lib/data_imp/finders.rb, line 6
def self.extended(mod)
  mod.delegate :find_parser, :find_importer, to: :class
end
included(mod) click to toggle source
# File lib/data_imp/finders.rb, line 10
def self.included(mod)
  mod.delegate :const_get, to: :class
end

Public Instance Methods

find_importer(type) click to toggle source
# File lib/data_imp/finders.rb, line 22
def find_importer type
  return type if type.kind_of? DataImp::Porter
  type = type.to_s.camelize
  const_get "#{type}Importer"
rescue NameError => e
  DataImp::Porter.find_importer type
end
find_parser(type) click to toggle source
# File lib/data_imp/finders.rb, line 14
def find_parser type
  return type if type.kind_of? DataImp::Parser
  type = type.to_s.camelize
  const_get "#{type}Parser"
rescue NameError => e
  DataImp::Parser.find_parser type
end