Module: Offshore
- Extended by:
- Offshore
- Included in:
- Offshore
- Defined in:
- lib/offshore/server/mutex.rb,
lib/offshore.rb,
lib/offshore/version.rb,
lib/offshore/client/host.rb,
lib/offshore/client/test.rb,
lib/offshore/client/suite.rb,
lib/offshore/server/redis.rb,
lib/offshore/server/errors.rb,
lib/offshore/server/logger.rb,
lib/offshore/server/railtie.rb,
lib/offshore/server/database.rb,
lib/offshore/server/snapshot.rb,
lib/offshore/server/snapshot.rb,
lib/offshore/server/controller.rb,
lib/offshore/server/middleware.rb
Overview
Defined Under Namespace
Modules: Database, Logger, Snapshot Classes: CheckBackLater, Controller, Host, Middleware, Mutex, Railtie, Suite, Test
Constant Summary collapse
- WAIT_CODE =
499
- VERSION =
"0.0.3"
Instance Method Summary collapse
-
#redis ⇒ Object
Returns the current Redis connection.
-
#redis=(server) ⇒ Object
Accepts: 1.
- #suite ⇒ Object
- #test ⇒ Object
Instance Method Details
#redis ⇒ Object
Returns the current Redis connection. If none has been created, will create a new one from the Reqsue one (with a different namespace)
34 35 36 37 38 |
# File 'lib/offshore/server/redis.rb', line 34 def redis return @redis if @redis self.redis = Redis.respond_to?(:connect) ? Redis.connect : "localhost:6379" self.redis end |
#redis=(server) ⇒ Object
Accepts:
1. A 'hostname:port' String
2. A 'hostname:port:db' String (to select the Redis db)
3. A 'hostname:port/namespace' String (to set the Redis namespace)
4. A Redis URL String 'redis://host:port'
5. An instance of `Redis`, `Redis::Client`, `Redis::DistRedis`,
or `Redis::Namespace`.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/offshore/server/redis.rb', line 11 def redis=(server) case server when String if server =~ /redis\:\/\// redis = Redis.connect(:url => server, :thread_safe => true) else server, namespace = server.split('/', 2) host, port, db = server.split(':') redis = Redis.new(:host => host, :port => port, :thread_safe => true, :db => db) end namespace ||= default_namespace @redis = Redis::Namespace.new(namespace, :redis => redis) when Redis::Namespace @redis = server else @redis = Redis::Namespace.new(default_namespace, :redis => server) end end |
#suite ⇒ Object
8 9 10 |
# File 'lib/offshore.rb', line 8 def suite @suite ||= Suite.new end |