Sha256: 4086c41229cbac0323aff06926ea2634dc03e6dbd5fcb08896e00fefd2d30e88

Contents?: true

Size: 809 Bytes

Versions: 16

Compression:

Stored size: 809 Bytes

Contents

module Loco
  class Config
    cattr_accessor(:silence_logger){ false }
    cattr_accessor(:notifications_size){ 100 }
    cattr_accessor(:app_name){ 'loco' }
    cattr_accessor(:redis_instance){ nil }

    def self.configure opts = {}
      self.silence_logger = opts[:silence_logger] if not opts[:silence_logger].nil?
      self.notifications_size = opts[:notifications_size] if opts[:notifications_size]
      self.app_name = opts[:app_name] if opts[:app_name]
      if opts[:redis_instance]
        self.redis_instance = opts[:redis_instance]
        return
      end
      return if not defined?(Redis)
      Redis.current.get 'random_redis_key'
      self.redis_instance = Redis.current
    rescue Redis::CannotConnectError
      self.redis_instance = nil
    ensure
      return true
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
loco-rails-2.5.3 lib/loco/config.rb
loco-rails-2.5.2 lib/loco/config.rb
loco-rails-2.5.1 lib/loco/config.rb
loco-rails-2.5.0 lib/loco/config.rb
loco-rails-2.4.0 lib/loco/config.rb
loco-rails-2.3.0 lib/loco/config.rb
loco-rails-3.0.0 lib/loco/config.rb
loco-rails-2.2.2 lib/loco/config.rb
loco-rails-2.2.1 lib/loco/config.rb
loco-rails-2.2.0 lib/loco/config.rb
loco-rails-2.1.0 lib/loco/config.rb
loco-rails-2.0.0 lib/loco/config.rb
loco-rails-1.5.2 lib/loco/config.rb
loco-rails-1.5.1 lib/loco/config.rb
loco-rails-1.5.0 lib/loco/config.rb
loco-rails-1.4.0 lib/loco/config.rb