lib/propono/configuration.rb in propono-0.5.6 vs lib/propono/configuration.rb in propono-0.6.0

- old
+ new

@@ -1,25 +1,22 @@ -require 'singleton' - module Propono - class ConfigurationError < Exception + class ProponoConfigurationError < ProponoError end class Configuration - include Singleton SETTINGS = [ :access_key, :secret_key, :queue_region, :application_name, :udp_host, :udp_port, :logger ] attr_writer *SETTINGS def initialize - self.logger = $stderr + self.logger = Propono::Logger.new end SETTINGS.each do |setting| define_method setting do get_or_raise(setting) @@ -27,14 +24,11 @@ end private def get_or_raise(setting) - if val = instance_variable_get("@#{setting.to_s}") - val - else - raise ConfigurationError.new("Configuration for #{setting} is not set") - end + instance_variable_get("@#{setting.to_s}") || + raise(ProponoConfigurationError.new("Configuration for #{setting} is not set")) end end end