Module: DataImp::Finders

Included in:
DataImp, Tds
Defined in:
lib/data_imp/finders.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(mod) ⇒ Object



6
7
8
# File 'lib/data_imp/finders.rb', line 6

def self.extended(mod)
  mod.delegate :find_parser, :find_importer, to: :class
end

.included(mod) ⇒ Object



10
11
12
# File 'lib/data_imp/finders.rb', line 10

def self.included(mod)
  mod.delegate :const_get, to: :class
end

Instance Method Details

#find_importer(type) ⇒ Object



22
23
24
25
26
27
28
# 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) ⇒ Object



14
15
16
17
18
19
20
# 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