Module: DataImp::Finders
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
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/data_imp/finders.rb', line 23 def find_importer type return type if type.kind_of? DataImp::Porter type = type.to_s.camelize "#{type}Importer".safe_constantize || "#{type.singularize}Importer".safe_constantize || "#{type.pluralize}Importer".safe_constantize || "#{type.singularize}Porter".safe_constantize || "#{type.pluralize}Porter".safe_constantize || DataImp::Porter.find_importer(type) end |
#find_parser(type) ⇒ Object
14 15 16 17 18 19 20 21 |
# 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 "#{type}Parser".safe_constantize || "#{type.singularize}Parser".safe_constantize || "#{type.pluralize}Parser".safe_constantize || DataImp::Parser.find_parser(type) end |