Module: Ampere
- Defined in:
- lib/ampere.rb,
lib/ampere/keys.rb,
lib/ampere/model.rb,
lib/rails/railtie.rb,
lib/ampere/collection.rb,
lib/ampere/timestamps.rb,
lib/rails/generators/ampere/model/model_generator.rb,
lib/rails/generators/ampere/config/config_generator.rb
Overview
:nodoc:
Defined Under Namespace
Modules: Generators, Keys, Model, Timestamps Classes: Collection, Railtie
Constant Summary collapse
- @@connection =
nil
Class Method Summary collapse
-
.connect(options = {}) ⇒ Object
Open a new Redis connection.
-
.connected? ⇒ Boolean
Returns ‘true` if the Redis connection is active.
-
.connection ⇒ Object
Gives access to the Redis connection object.
-
.disconnect ⇒ Object
Closes the Redis connection.
-
.flush ⇒ Object
Alias for Ampere.redis.flushall.
Class Method Details
.connect(options = {}) ⇒ Object
Open a new Redis connection. ‘options` is passed directly to the Redis.connect method.
13 14 15 |
# File 'lib/ampere.rb', line 13 def self.connect( = {}) @@connection = Redis.connect() end |
.connected? ⇒ Boolean
Returns ‘true` if the Redis connection is active.
25 26 27 |
# File 'lib/ampere.rb', line 25 def self.connected? !! @@connection end |
.connection ⇒ Object
Gives access to the Redis connection object.
30 31 32 |
# File 'lib/ampere.rb', line 30 def self.connection @@connection end |
.disconnect ⇒ Object
Closes the Redis connection.
18 19 20 21 22 |
# File 'lib/ampere.rb', line 18 def self.disconnect return unless connected? @@connection.quit @@connection = nil end |
.flush ⇒ Object
Alias for Ampere.redis.flushall
35 36 37 |
# File 'lib/ampere.rb', line 35 def self.flush @@connection.flushall if connected? end |