require 'bearcat/version' require 'bearcat/client' module Bearcat class << self require 'logger' attr_accessor :master_rate_limit attr_writer :rate_limit_min, :rate_limits, :max_sleep_seconds, :min_sleep_seconds, :logger, :rate_limiter def configure yield self if block_given? end def rate_limiter @rate_limiter end def rate_limit_min @rate_limit_min ||= 175 end def min_sleep_seconds @min_sleep_seconds ||= 5 end def max_sleep_seconds @max_sleep_seconds ||= 60 end def logger return @logger if defined? @logger @logger = Logger.new(STDOUT) @logger.level = Logger::DEBUG @logger end def redis_pool require 'bearcat/redis_connection' @redis_pool ||= RedisConnection.create(env_prefix: "BEARCAT") end def redis raise ArgumentError, "requires a block" unless block_given? redis_pool.with do |conn| yield conn end end end end