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.
11 12 13 |
# File 'lib/ampere.rb', line 11 def self.connect( = {}) @@connection = Redis.connect() end |
.connected? ⇒ Boolean
Returns ‘true` if the Redis connection is active.
23 24 25 |
# File 'lib/ampere.rb', line 23 def self.connected? !! @@connection end |
.connection ⇒ Object
Gives access to the Redis connection object.
28 29 30 |
# File 'lib/ampere.rb', line 28 def self.connection @@connection end |
.disconnect ⇒ Object
Closes the Redis connection.
16 17 18 19 20 |
# File 'lib/ampere.rb', line 16 def self.disconnect return unless connected? @@connection.quit @@connection = nil end |
.flush ⇒ Object
Alias for Ampere.redis.flushall
33 34 35 |
# File 'lib/ampere.rb', line 33 def self.flush @@connection.flushall if connected? end |