Class: SimpleMapReduce::DataStoreFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_map_reduce/data_store_factory.rb

Constant Summary collapse

TYPES =
%w(default remote).freeze

Class Method Summary collapse

Class Method Details

.create(data_store_type, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/simple_map_reduce/data_store_factory.rb', line 8

def create(data_store_type, options = {})
  unless TYPES.include?(data_store_type)
    raise ArgumentError, "Unsupported data_store_type: `#{data_store_type}`"
  end

  case data_store_type
  when 'default'
    SimpleMapReduce::DataStores::DefaultDataStore.new(options)
  when 'remote'
    SimpleMapReduce::DataStores::RemoteDataStore.new(options)
  end
end