Sha256: eafaf8c9885fb1a3a9b60083e61135b69df97c0994fd068cbbf73129ddff5125
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
# frozen_string_literal: true require 'redis_web_manager/engine' require 'redis_web_manager/base' require 'redis_web_manager/action' require 'redis_web_manager/connection' require 'redis_web_manager/info' require 'redis_web_manager/data' require 'active_support/time' require 'redis' module RedisWebManager mattr_accessor :redises, default: { default: Redis.new } mattr_accessor :lifespan, default: 15.days mattr_accessor :authenticate, default: nil class << self def configure yield self if block_given? check_attrs end private def check_attrs unless redises.is_a?(::Hash) raise(ArgumentError, 'Invalid redises hash, use like that { test: Redis.new }') end redises.each do |k, v| unless v.is_a?(Redis) raise(ArgumentError, "Invalid Redis instance for #{k}, use like that Redis.new") end end unless lifespan.is_a?(::ActiveSupport::Duration) raise(ArgumentError, 'Invalid lifespan, use like that 15.days, 15.minutes etc') end valid = lifespan.to_i.positive? raise(ArgumentError, 'Invalid lifespan, value must be greater than 0') unless valid end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
redis_web_manager-0.4.0 | lib/redis_web_manager.rb |
redis_web_manager-0.3.9 | lib/redis_web_manager.rb |
redis_web_manager-0.3.8 | lib/redis_web_manager.rb |