Module: Ohm
- Defined in:
- lib/ohm/version.rb,
lib/ohm.rb,
lib/ohm/key.rb,
lib/ohm/collection.rb,
lib/ohm/validations.rb,
lib/ohm/compat-1.8.6.rb,
lib/ohm/utils/upgrade.rb
Overview
encoding: UTF-8
Defined Under Namespace
Modules: Utils, Validations Classes: Collection, Key, List, Model, Set
Constant Summary
- Error =
Class.new(StandardError)
- VERSION =
"0.1.0.rc2"- BasicObject =
BasicObject
Instance Method Summary (collapse)
-
- (Object) connect(*options)
Connect to a redis database.
-
- (Object) connection(*options)
Return a connection to Redis.
-
- (Object) flush
Clear the database.
- - (Object) key(*args)
- - (Object) options
-
- (Object) redis
Provides access to the Redis database.
- - (Object) redis(connection)
- - (Object) threaded
Instance Method Details
- (Object) connect(*options)
Connect to a redis database.
35 36 37 38 |
# File 'lib/ohm.rb', line 35 def connect(*) self.redis = nil @options = end |
- (Object) connection(*options)
Return a connection to Redis.
This is a wapper around Redis.new(options)
43 44 45 |
# File 'lib/ohm.rb', line 43 def connection(*) Redis.new(*) end |
- (Object) flush
Clear the database.
52 53 54 |
# File 'lib/ohm.rb', line 52 def flush redis.flushdb end |
- (Object) key(*args)
56 57 58 |
# File 'lib/ohm.rb', line 56 def key(*args) Key[*args] end |
- (Object) options
47 48 49 |
# File 'lib/ohm.rb', line 47 def @options || [] end |
- (Object) redis
Provides access to the Redis database. This is shared accross all models and instances.
14 15 16 |
# File 'lib/ohm.rb', line 14 def redis threaded[:redis] ||= connection(*) end |
- (Object) redis=(connection)
18 19 20 |
# File 'lib/ohm.rb', line 18 def redis=(connection) threaded[:redis] = connection end |
- (Object) threaded
22 23 24 |
# File 'lib/ohm.rb', line 22 def threaded Thread.current[:ohm] ||= {} end |