Sha256: bfc5fae62f70ff3a600391ae69d332f0e068d11ddf1abd172e9af6d35bf6a570
Contents?: true
Size: 751 Bytes
Versions: 7
Compression:
Stored size: 751 Bytes
Contents
module Loquor class LoquorError < StandardError end class LoquorConfigurationError < LoquorError end class Configuration SETTINGS = [ :logger, :access_id, :secret_key, :endpoint, :substitute_values, :retry_404s ] attr_writer *SETTINGS attr_accessor :cache def initialize self.logger = Filum.logger self.substitute_values = {} self.retry_404s = false end SETTINGS.each do |setting| define_method setting do get_or_raise(setting) end end private def get_or_raise(setting) val = instance_variable_get("@#{setting.to_s}") raise(LoquorConfigurationError.new("Configuration for #{setting} is not set")) if val.nil? val end end end
Version data entries
7 entries across 7 versions & 1 rubygems