Sha256: 935e68ff971fd6b82ffadfc943a8d354cb28feedbe9a9a8d197153241d2daf06
Contents?: true
Size: 837 Bytes
Versions: 4
Compression:
Stored size: 837 Bytes
Contents
# -*- encoding : utf-8 -*- #Wrapper for redis connection #============================ #Creates only one connection to redis per application in first time it needs to work with redis module Database def self.config if File.exists?('config/redis_config.yml') YAML.load_file('config/redis_config.yml')[ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'].symbolize_keys else FileUtils.mkdir_p('config') unless File.exists?('config') FileUtils.cp(File.join(File.dirname(__FILE__),"../config/redis_config.yml.example"), 'config/redis_config.yml.example') raise ArgumentError, "Redis configuration file does not exists -> 'config/redis_config.yml', please provide it! I have created example file in config directory..." end end def self.redis @redis ||= Redis.new(Database.config) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
redis-model-extension-0.3.3 | lib/database.rb |
redis-model-extension-0.3.2 | lib/database.rb |
redis-model-extension-0.3.1 | lib/database.rb |
redis-model-extension-0.3.0 | lib/database.rb |