Sha256: 10920854248f8633fcd059fd72b6a4a855f7428e9e0b19b4cb99ec54ea092d0e
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
module Propono class ProponoConfigurationError < ProponoError end class Configuration def self.add_setting(sym, required: true) define_method(sym) do required ? get_or_raise(sym) : @settings[sym] end define_method("#{sym}=") do |new_value| @settings[sym] = new_value end end add_setting :access_key add_setting :secret_key add_setting :queue_region add_setting :application_name add_setting :logger add_setting :max_retries add_setting :num_messages_per_poll add_setting :use_iam_profile, required: false add_setting :queue_suffix, required: false def initialize @settings = { logger: Propono::Logger.new, queue_suffix: "", use_iam_profile: false, max_retries: 0, num_messages_per_poll: 10 } end private def get_or_raise(setting) @settings[setting] || raise(ProponoConfigurationError.new("Configuration for #{setting} is not set")) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
propono-2.1.0 | lib/propono/configuration.rb |
propono-2.0.0 | lib/propono/configuration.rb |
propono-2.0.0.rc3 | lib/propono/configuration.rb |