Class: Swineherd::FileSystem

Inherits:
Object
  • Object
show all
Defined in:
lib/swineherd/filesystem.rb

Constant Summary collapse

FILESYSTEMS =
{
  'file' => Swineherd::LocalFileSystem,
  'hdfs' => Swineherd::HadoopFileSystem,
  's3'   => Swineherd::S3FileSystem
}

Class Method Summary collapse

Class Method Details

.get(scheme, *args) ⇒ Object

A factory function that returns an instance of the requested class



16
17
18
19
20
21
22
# File 'lib/swineherd/filesystem.rb', line 16

def self.get scheme, *args
  begin
    FILESYSTEMS[scheme.to_s].new *args
  rescue NoMethodError => e
    raise "Filesystem with scheme #{scheme} does not exist.\n #{e.message}"
  end
end