lib/pallets.rb in pallets-0.1.0 vs lib/pallets.rb in pallets-0.2.0
- old
+ new
@@ -9,16 +9,18 @@
require 'pallets/manager'
require 'pallets/pool'
require 'pallets/scheduler'
require 'pallets/serializers/base'
require 'pallets/serializers/json'
+require 'pallets/serializers/msgpack'
require 'pallets/task'
+require 'pallets/util'
require 'pallets/worker'
require 'pallets/workflow'
-require 'active_support/inflector'
require 'logger'
+require 'securerandom'
module Pallets
def self.configuration
@configuration ||= Configuration.new
end
@@ -27,11 +29,11 @@
yield configuration
end
def self.backend
@backend ||= begin
- cls = "Pallets::Backends::#{configuration.backend.capitalize}".constantize
+ cls = Pallets::Util.constantize("Pallets::Backends::#{configuration.backend.capitalize}")
cls.new(
namespace: configuration.namespace,
blocking_timeout: configuration.blocking_timeout,
job_timeout: configuration.job_timeout,
pool_size: configuration.pool_size,
@@ -40,10 +42,10 @@
end
end
def self.serializer
@serializer ||= begin
- cls = "Pallets::Serializers::#{configuration.serializer.capitalize}".constantize
+ cls = Pallets::Util.constantize("Pallets::Serializers::#{configuration.serializer.capitalize}")
cls.new
end
end
def self.logger