Sha256: a7c3f824469ede4f05111b599b96e0caa473e093255e9d4284cac20314457a66

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

require 'gem_config'

require_relative 'services/logger/null'

module Services
  include GemConfig::Base

  NoBackgroundProcessorFound = Class.new(StandardError)
  RedisNotFound              = Class.new(StandardError)

  with_configuration do
    has :logger, default: Services::Logger::Null.new
    has :redis
    has :allowed_class_methods_in_queries, default: {}
  end

  def self.redis
    @redis ||= self.configuration.redis || (defined?(Redis.current) && Redis.current) or fail RedisNotFound, 'Redis not configured.'
  end

  def self.allow_class_method_in_queries(klass, method, arity = nil)
    (configuration.allowed_class_methods_in_queries[klass.to_s] ||= {})[method.to_sym] = arity
  end
end

require_relative 'services/version'
require_relative 'services/logger/file'
require_relative 'services/logger/redis'
require_relative 'services/asyncable'
require_relative 'services/modules/call_logger'
require_relative 'services/modules/exception_wrapper'
require_relative 'services/modules/object_class'
require_relative 'services/modules/uniqueness_checker'
require_relative 'services/base'
require_relative 'services/query'
require_relative 'services/railtie' if defined?(Rails)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
services-8.0.1 lib/services.rb
services-8.0.0 lib/services.rb
services-7.3.3 lib/services.rb
services-7.3.1 lib/services.rb
services-7.3.0 lib/services.rb