lib/inquisitio/configuration.rb in inquisitio-0.1.6 vs lib/inquisitio/configuration.rb in inquisitio-0.1.7

- old
+ new

@@ -7,16 +7,19 @@ 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) @@ -24,11 +27,11 @@ end private def get_or_raise(setting) - instance_variable_get("@#{setting.to_s}") || - raise(InquisitioConfigurationError.new("Configuration for #{setting} is not set")) + val = instance_variable_get("@#{setting.to_s}") + val.nil?? raise(InquisitioConfigurationError.new("Configuration for #{setting} is not set")) : val end end end