lib/tracksperanto.rb in tracksperanto-1.7.0 vs lib/tracksperanto.rb in tracksperanto-1.7.1

- old
+ new

@@ -2,11 +2,11 @@ require 'delegate' require 'tempfile' module Tracksperanto PATH = File.expand_path(File.dirname(__FILE__)) - VERSION = '1.7.0' + VERSION = '1.7.1' module Import; end module Export; end module Middleware; end module Pipeline; end @@ -37,9 +37,28 @@ end end self.exporters, self.importers, self.middlewares = [], [], [] + # Case-insensitive search for an export module by name + def self.get_exporter(name) + exporters.each do | x | + normalized_name = x.to_s.split("::")[-1].downcase + return x if normalized_name == name.downcase + end + + raise NameError, "Unknown exporter #{name}" + end + + # Case-insensitive search for an export module by name + def self.get_importer(name) + importers.each do | x | + normalized_name = x.to_s.split("::")[-1].downcase + return x if normalized_name == name.downcase + end + + raise NameError, "Unknown importer #{name}" + end end %w( const_name casts \ No newline at end of file