Module: OnetimeToken
- Defined in:
- lib/onetime_token.rb,
lib/onetime_token/token.rb,
lib/onetime_token/version.rb,
lib/onetime_token/has_token.rb
Defined Under Namespace
Modules: HasToken
Classes: Token
Constant Summary
collapse
- VERSION =
"0.0.1"
Class Method Summary
collapse
Class Method Details
15
16
17
|
# File 'lib/onetime_token.rb', line 15
def configure
yield self
end
|
.extended(base) ⇒ Object
11
12
13
|
# File 'lib/onetime_token.rb', line 11
def extended(base)
base.extend HasToken
end
|
.redis=(connection_options) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/onetime_token.rb', line 23
def redis=(connection_options)
@redis =
if connection_options.is_a?(ConnectionPool)
connection_options
else
pool_options = {timeout: 1, size: 1}.
merge(connection_options.delete(:pool) || {})
ConnectionPool::Wrapper.new(pool_options) do
namespace = connection_options.delete(:namespace) || 'onetime_token'
client = Redis.new(connection_options)
Redis::Namespace.new(namespace, redis: client)
end
end
end
|
.redis_pool ⇒ Object
19
20
21
|
# File 'lib/onetime_token.rb', line 19
def redis_pool
@redis
end
|