Sha256: c0d96a449ce74b6b59c9369a6f49d8e9943febab83280c14ae251f409b73e429

Contents?: true

Size: 559 Bytes

Versions: 9

Compression:

Stored size: 559 Bytes

Contents

module NightcrawlerSwift
  class Options < OpenStruct

    def initialize params = {}
      params[:password] = ENV["NSWIFT_PASSWORD"] || params[:password]
      super defaults.merge(params)
      validate_max_age!
    end

    protected
    def defaults
      {
        retries: 5,
        max_retry_time: 30,
        verify_ssl: false
      }
    end

    private
    def validate_max_age!
      if self.max_age and not self.max_age.is_a?(Numeric)
        raise Exceptions::ConfigurationError.new "max_age should be an Integer"
      end
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
nightcrawler_swift-1.0.0 lib/nightcrawler_swift/options.rb
nightcrawler_swift-0.11.1 lib/nightcrawler_swift/options.rb
nightcrawler_swift-0.11.0 lib/nightcrawler_swift/options.rb
nightcrawler_swift-0.10.0 lib/nightcrawler_swift/options.rb
nightcrawler_swift-0.9.0 lib/nightcrawler_swift/options.rb
nightcrawler_swift-0.8.1 lib/nightcrawler_swift/options.rb
nightcrawler_swift-0.8.0 lib/nightcrawler_swift/options.rb
nightcrawler_swift-0.7.0 lib/nightcrawler_swift/options.rb
nightcrawler_swift-0.6.0 lib/nightcrawler_swift/options.rb