Sha256: 5023808a2cf875a96aa654099a44bea81bd79c8801d199c2a4f96ad590017124
Contents?: true
Size: 691 Bytes
Versions: 2
Compression:
Stored size: 691 Bytes
Contents
require 'singleton' module Propono class ConfigurationError < Exception 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 end SETTINGS.each do |setting| define_method setting do get_or_raise(setting) end 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 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
propono-0.5.6 | lib/propono/configuration.rb |
propono-0.5.5 | lib/propono/configuration.rb |