Module: Patriot::JobStore::Factory

Included in:
Worker::Base
Defined in:
lib/patriot/job_store/factory.rb

Overview

a moulde for a factory method of JobStores

Class Method Summary collapse

Class Method Details

.create_jobstore(store_id, config) ⇒ Patriot::JobStore::Base

create JobStore for given store_id based on the configuration

Parameters:

  • store_id (String)

    JobStore ID to identify configuration parameters

  • config (Patriot::Util::Config::Base)

    configuration to create a JobStore

Returns:



9
10
11
12
13
14
15
# File 'lib/patriot/job_store/factory.rb', line 9

def create_jobstore(store_id, config)
  cls = config.get([Patriot::JobStore::CONFIG_PREFIX, store_id, "class"].join("."))
  # TODO set default store
  raise "class for job store #{store_id} is not specified" if cls.nil?
  job_store = eval(cls).new(store_id, config)
  return job_store
end