lib/safely.rb in safely-0.1.0pre vs lib/safely.rb in safely-0.1.0
- old
+ new
@@ -1,13 +1,14 @@
$:.unshift File.expand_path('../', __FILE__)
module Safely
- VERSION = "0.1.0pre"
+ VERSION = "0.1.0"
- autoload :Config, 'safely/config'
- autoload :Mixin, 'safely/mixin'
+ autoload :Config, 'safely/config'
+ autoload :Mixin, 'safely/mixin'
+ autoload :Strategy, 'safely/strategy'
class << self
def reset!
self.config = nil
@@ -20,22 +21,16 @@
def config
@config ||= Safely::Config.new
end
def load_strategies!
- begin
- require 'toadhopper'
- rescue LoadError
- # Print warning
- end
+ @config.strategies.each { |s| s.load! }
end
def report!( exception )
- if defined?( Toadhopper ) && !config.hoptoad_key.nil?
- Toadhopper( config.hoptoad_key ).post!( exception )
- else
- STDERR.puts "Toadhopper not available or not configured!"
- end
+ load_strategies! if @config.nil?
+
+ @config.strategies.each { |s| s.report! exception }
end
private
def config=( config )