Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

Commit

Permalink
fix poorly named file
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwell committed Jan 5, 2012
1 parent e058c44 commit 5626af6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 52 deletions.
40 changes: 0 additions & 40 deletions lib/rack/google-analytics.rb

This file was deleted.

16 changes: 4 additions & 12 deletions lib/rack/piwik.rb
Expand Up @@ -3,12 +3,10 @@

module Rack

class GoogleAnalytics
class Piwik

DEFAULT = { :async => true }

def initialize(app, options = {})
raise ArgumentError, "Tracker must be set!" unless options[:tracker] and !options[:tracker].empty?
raise ArgumentError, "piwik_url must be present" unless options[:piwik_url] and !options[:piwik_url].empty?
@app, @options = app, DEFAULT.merge(options)
end

Expand All @@ -27,15 +25,9 @@ def _call(env)
def html?; @headers['Content-Type'] =~ /html/; end

def inject(response)
file = @options[:async] ? 'async' : 'sync'
file = 'async'
@template ||= ::ERB.new ::File.read ::File.expand_path("../templates/#{file}.erb",__FILE__)
if @options[:async]
response.gsub(%r{</head>}, @template.result(binding) + "</head>")
else
response.gsub(%r{</body>}, @template.result(binding) + "</body>")
end
response.gsub(%r{</head>}, @template.result(binding) + "</head>")
end

end

end

0 comments on commit 5626af6

Please sign in to comment.