Class: Msewage::Importer::Importers::Base
- Inherits:
-
Object
- Object
- Msewage::Importer::Importers::Base
- Defined in:
- lib/msewage-importer/importers/base.rb
Class Method Summary collapse
- .factory(file_name) ⇒ Object
- .importers ⇒ Object
- .load_importers ⇒ Object
- .type(*file_types) ⇒ Object
Instance Method Summary collapse
- #import ⇒ Object
-
#initialize(file_name) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(file_name) ⇒ Base
Returns a new instance of Base.
32 33 34 |
# File 'lib/msewage-importer/importers/base.rb', line 32 def initialize(file_name) @file_name = file_name end |
Class Method Details
.factory(file_name) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/msewage-importer/importers/base.rb', line 11 def factory(file_name) #load_importers importers.each_pair do |extension, class_name| if file_name =~ %r{#{extension}} return class_name.new(file_name) end end end |
.importers ⇒ Object
27 28 29 |
# File 'lib/msewage-importer/importers/base.rb', line 27 def importers @importers ||= {} end |
.load_importers ⇒ Object
20 21 22 23 24 25 |
# File 'lib/msewage-importer/importers/base.rb', line 20 def load_importers #dirname = File.dirname(__FILE__) #Dir[File.join(dirname, "*.rb")].each do |f| # require f.gsub(%r{#{dirname}/lib/}, '').gsub(/.rb/, '') unless f =~ /base/ #end end |
Instance Method Details
#import ⇒ Object
36 37 38 |
# File 'lib/msewage-importer/importers/base.rb', line 36 def import raise "OVERRIDE ME" end |