Module: Useless::Mongo

Defined in:
lib/useless/mongo.rb

Class Method Summary collapse

Class Method Details

.for_env(env = nil) ⇒ Object

Returns an instance of the appropriate ‘Low::Mongo` helper class based upon the `RACK_ENV` environment variable (or the `env` parameter, if specified).



7
8
9
10
11
12
13
# File 'lib/useless/mongo.rb', line 7

def self.for_env(env = nil)
  case (env || ENV['RACK_ENV'])
  when 'test'       then Low::Mongo::Local.new 'useless_test'
  when 'production' then Low::Mongo::Remote.new ENV['MONGOLAB_URI']
  else                   Low::Mongo::Local.new 'useless_development'
  end
end