Skip to content

Commit

Permalink
allow using global client instance
Browse files Browse the repository at this point in the history
  • Loading branch information
lest committed May 30, 2014
1 parent 110bf68 commit c90229c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/smscru.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
require 'smscru/callback'

module Smscru
extend SingleForwardable

def_delegators :client, :send_message

class << self
attr_reader :config

Expand All @@ -12,6 +16,10 @@ def configure(options={}, &block)
@config.update(options)
yield @config if block_given?
end

def client
@client ||= Client.new
end
end

configure
Expand Down
2 changes: 1 addition & 1 deletion lib/smscru/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Smscru
class Client
attr_reader :config

def initialize(options)
def initialize(options={})
@config = Smscru.config.dup
@config.update(options)
end
Expand Down

0 comments on commit c90229c

Please sign in to comment.