Sha256: 52946e4204fc675f6e6ab31ed8727cff735ff1782022bef6589ab3d54e74c064
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
require 'tincan/version' require 'tincan/utils' require 'tincan/phone_number' require 'tincan/application' require 'tincan/sms' require 'redis' require 'redis/namespace' module Tincan def self.configure yield self end def self.redis # Set redis to nothing make the setter run and setup a default if it's nothing self.redis = {} unless defined? @@redis # Return the namespaced Redis instance @@redis end def self.redis=(options = {}) client = nil if options.is_a?(Redis) client = options else url = options[:url] || determine_redis_provider || 'redis://localhost:6379/0' driver = options[:driver] || 'ruby' namespace = options[:namespace] || 'tincan' client = Redis.connect(url: url, driver: driver) end @@redis = Redis::Namespace.new(namespace, redis: client) end def self.sms_sender SMS.sender end def self.sms_sender=(sender) SMS.sender = sender end private def self.determine_redis_provider return ENV['REDISTOGO_URL'] if ENV['REDISTOGO_URL'] provider = ENV['REDIS_PROVIDER'] || 'REDIS_URL' ENV[provider] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tincan-0.1.6 | lib/tincan.rb |
tincan-0.1.5 | lib/tincan.rb |