Sha256: d312ca6135a13b769c9bb96b00e2d2b54b66300581afe4b6157971c2407d4ffb
Contents?: true
Size: 697 Bytes
Versions: 1
Compression:
Stored size: 697 Bytes
Contents
module Inquisitio class InquisitioConfigurationError < InquisitioError end class Configuration SETTINGS = [ :search_endpoint, :document_endpoint, :default_search_size, :dry_run, :logger ] attr_writer *SETTINGS def initialize self.logger = Inquisitio::Logger.new self.dry_run = 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}") val.nil?? raise(InquisitioConfigurationError.new("Configuration for #{setting} is not set")) : val end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
inquisitio-0.1.7 | lib/inquisitio/configuration.rb |