lib/rocket_job/config.rb in rocketjob-5.1.1 vs lib/rocket_job/config.rb in rocketjob-5.2.0.beta1
- old
+ new
@@ -1,6 +1,6 @@
-require 'yaml'
+require "yaml"
module RocketJob
# Rocket Job Configuration
class Config
include SemanticLogger::Loggable
@@ -70,23 +70,23 @@
# RocketJob::Config.where_filter = { "priority" => {"$lte" => 25}}
class_attribute :where_filter
self.where_filter = nil
# Configure Mongoid
- def self.load!(environment = 'development', file_name = nil, encryption_file_name = nil)
- config_file = file_name ? Pathname.new(file_name) : Pathname.pwd.join('config/mongoid.yml')
+ def self.load!(environment = "development", file_name = nil, encryption_file_name = nil)
+ config_file = file_name ? Pathname.new(file_name) : Pathname.pwd.join("config/mongoid.yml")
raise(ArgumentError, "Mongo Configuration file: #{config_file} not found") unless config_file.file?
logger.debug "Reading Mongo configuration from: #{config_file}"
::Mongoid.load!(config_file, environment)
config_file =
if encryption_file_name
Pathname.new(encryption_file_name)
else
- Pathname.pwd.join('config/symmetric-encryption.yml')
+ Pathname.pwd.join("config/symmetric-encryption.yml")
end
return unless config_file.file?
logger.debug "Reading SymmetricEncryption configuration from: #{config_file}"
@@ -95,16 +95,14 @@
# Returns [Hash] the where clause built from the filters above:
# include_filter, exclude_filter, and where_filter.
# Returns nil if no filter should be applied.
def self.filter
- if include_filter && exclude_filter
- raise(ArgumentError, 'Cannot supply both an include_filter and an exclude_filter')
- end
+ raise(ArgumentError, "Cannot supply both an include_filter and an exclude_filter") if include_filter && exclude_filter
filter = where_filter
- (filter ||= {})['_type'] = include_filter if include_filter
- (filter ||= {})['_type'] = {'$not' => exclude_filter} if exclude_filter
- filter
+ (filter ||= {})["_type"] = include_filter if include_filter
+ (filter ||= {})["_type"] = {"$not" => exclude_filter} if exclude_filter
+ filter&.dup
end
end
end