Sha256: cc3e426974fe5de6e797481bb6c6314720d1d823012f3a2399328e8fe260bf0e
Contents?: true
Size: 602 Bytes
Versions: 1
Compression:
Stored size: 602 Bytes
Contents
require 'singleton' module Propono class ConfigurationError < Exception end class Configuration include Singleton SETTINGS = [:access_key, :secret_key, :queue_region, :application_name] attr_writer *SETTINGS def initialize 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
propono-0.2.0 | lib/propono/configuration.rb |