lib/sinatra/toadhopper.rb in toadhopper-sinatra-1.0.2 vs lib/sinatra/toadhopper.rb in toadhopper-sinatra-1.0.3
- old
+ new
@@ -2,19 +2,20 @@
require 'toadhopper'
module Sinatra
# The Toadhopper helper methods
module Toadhopper
- VERSION = "1.0.2"
+ VERSION = "1.0.3"
# Reports the current sinatra error to Hoptoad
def post_error_to_hoptoad!
unless options.toadhopper && options.toadhopper[:api_key]
STDERR.puts "Toadhopper api key not set, e.g. set :toadhopper, :api_key => 'my api key'"
return
end
- toadhopper = Toadhopper(options.toadhopper[:api_key])
- toadhopper.filters = options.toadhopper[:filters] if options.toadhopper[:filters]
+ filters = options.toadhopper.delete(:filters)
+ toadhopper = ::Toadhopper.new(options.toadhopper.delete(:api_key), options.toadhopper)
+ toadhopper.filters = filters if filters
toadhopper.post!(
env['sinatra.error'],
{
:url => request.url,
:params => request.params,
@@ -29,6 +30,6 @@
{'X-Hoptoad-Client-Name' => notifier_name}
)
end
end
helpers Toadhopper
-end
\ No newline at end of file
+end