lib/truemail/configuration.rb in truemail-0.1.3 vs lib/truemail/configuration.rb in truemail-0.1.4

- old
+ new

@@ -2,24 +2,27 @@ module Truemail class Configuration DEFAULT_CONNECTION_TIMEOUT = 2 DEFAULT_RESPONSE_TIMEOUT = 2 + DEFAULT_RETRY_COUNT = 1 attr_reader :email_pattern, :verifier_email, :verifier_domain, :connection_timeout, :response_timeout, + :retry_count, :validation_type_by_domain attr_accessor :smtp_safe_check def initialize @email_pattern = Truemail::RegexConstant::REGEX_EMAIL_PATTERN - @connection_timeout = DEFAULT_CONNECTION_TIMEOUT - @response_timeout = DEFAULT_RESPONSE_TIMEOUT + @connection_timeout = Truemail::Configuration::DEFAULT_CONNECTION_TIMEOUT + @response_timeout = Truemail::Configuration::DEFAULT_RESPONSE_TIMEOUT + @retry_count = Truemail::Configuration::DEFAULT_RETRY_COUNT @validation_type_by_domain = {} @smtp_safe_check = false end def email_pattern=(regex_pattern) @@ -36,10 +39,10 @@ def verifier_domain=(domain) validate_arguments(domain, __method__) @verifier_domain = domain.downcase end - %i[connection_timeout response_timeout].each do |method| + %i[connection_timeout response_timeout retry_count].each do |method| define_method("#{method}=") do |argument| raise ArgumentError.new(argument, __method__) unless argument.is_a?(Integer) && argument.positive? instance_variable_set(:"@#{method}", argument) end end