Sha256: b7a863ef316f34c0624ccd3b936033f60db8221ea355fb1478df0c3f19921b98
Contents?: true
Size: 565 Bytes
Versions: 1
Compression:
Stored size: 565 Bytes
Contents
require 'singleton' module Pergo class ConfigurationError < Exception end class Configuration include Singleton SETTINGS = [ :access_key, :secret_key, :queue_region, :topic, :host, :port ] attr_writer *SETTINGS SETTINGS.each do |setting| define_method setting do get_or_raise(setting) end end private def get_or_raise(setting) instance_variable_get("@#{setting.to_s}") || raise(ConfigurationError.new("Configuration for #{setting} is not set")) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pergo-0.2.0 | lib/pergo/configuration.rb |