Module: CheckIn
- Defined in:
- lib/check_in.rb,
lib/check_in/reader.rb,
lib/check_in/writer.rb
Defined Under Namespace
Modules: Writer
Classes: Reader
Class Method Summary
collapse
Class Method Details
.redis ⇒ Object
26
27
28
|
# File 'lib/check_in.rb', line 26
def redis
@redis || raise("You must set the redis instance.")
end
|
.redis=(server) ⇒ Object
Accepts:
1. A 'hostname:port' string
2. A 'hostname:port:db' string (to select the Redis db)
3. An instance of `Redis`, `Redis::Client`, `Redis::DistRedis`,
or `Redis::Namespace`.
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/check_in.rb', line 13
def redis=(server)
if server.respond_to? :split
host, port, db = server.split(':')
redis = Redis.new(:host => host, :port => port,
:thread_safe => true, :db => db)
@redis = Redis::Namespace.new(:check_in, :redis => redis)
elsif server.respond_to? :namespace=
@redis = server
else
@redis = Redis::Namespace.new(:check_in, :redis => server)
end
end
|
34
35
36
|
# File 'lib/check_in.rb', line 34
def time_format
@time_format ||= "%b %d %Y %H:%M:%S"
end
|
30
31
32
|
# File 'lib/check_in.rb', line 30
def time_format=(format)
@time_format = format
end
|