Class: MetaBuild::Extractor::ExtractorFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/meta_build/extractor/extractor_factory.rb

Class Method Summary collapse

Class Method Details

.build(options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/meta_build/extractor/extractor_factory.rb', line 7

def build(options = {})
  ext = File.extname(options[:file]).sub /\A\./, ''
  case ext
    when 'ear' then EarExtractor.new options
    when 'war' then WarExtractor.new options
    when 'jar' then JarExtractor.new options
    else raise MetaBuild::Exceptions::MetaBuildException.new "Could not find suitable extractor to '#{ext.upcase}' type."
  end
end