Module: Tincan

Defined in:
lib/tincan.rb,
lib/tincan/sms.rb,
lib/tincan/utils.rb,
lib/tincan/version.rb,
lib/tincan/application.rb,
lib/tincan/phone_number.rb

Defined Under Namespace

Modules: Utils Classes: Application, PhoneNumber, SMS

Constant Summary collapse

VERSION =
'0.1.6'

Class Method Summary collapse

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Tincan)

    the object that the method was called on



11
12
13
# File 'lib/tincan.rb', line 11

def self.configure
  yield self
end

.redisObject



15
16
17
18
19
20
21
# File 'lib/tincan.rb', line 15

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

.redis=(options = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/tincan.rb', line 23

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

.sms_senderObject



38
39
40
# File 'lib/tincan.rb', line 38

def self.sms_sender
  SMS.sender
end

.sms_sender=(sender) ⇒ Object



42
43
44
# File 'lib/tincan.rb', line 42

def self.sms_sender=(sender)
  SMS.sender = sender
end