Skip to content

Commit

Permalink
Move class methods into ClassMethods module for better extensibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
arronmabrey committed Mar 19, 2013
1 parent 1f14b36 commit 7678834
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions lib/analytics-ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
require 'analytics-ruby/client'

module AnalyticsRuby
module ClassMethods
# By default use a single client for the module
def init(options = {})
@client = AnalyticsRuby::Client.new(options)
end

# By default use a single client for the module
def self.init(options = {})
@client = AnalyticsRuby::Client.new(options)
end

def self.track(options)
return false unless @client
@client.track(options)
end
def track(options)
return false unless @client
@client.track(options)
end

def self.identify(options)
return false unless @client
@client.identify(options)
def identify(options)
return false unless @client
@client.identify(options)
end
end


extend ClassMethods
end

# Alias for AnalyticsRuby
Expand Down

0 comments on commit 7678834

Please sign in to comment.