Sha256: 40b4128b8261ed3d64df65bee7cbe727ecc33f6f5741fb7279403408bb80efde

Contents?: true

Size: 563 Bytes

Versions: 2

Compression:

Stored size: 563 Bytes

Contents

require 'ostruct'

class Hwacha
  class Config < OpenStruct
    def hydra_options
      options = {}
      options.merge(concurrency_option)
    end

    def request_options
      options = {}
      options.merge(follow_redirects_option)
    end

    private

    def concurrency_option
      return {} if max_concurrent_requests.nil?
      { :max_concurrency => max_concurrent_requests }
    end

    def follow_redirects_option
      return { :followlocation => false } if follow_redirects.nil?
      { :followlocation => !!follow_redirects }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hwacha-1.0.1 lib/hwacha/config.rb
hwacha-1.0.0 lib/hwacha/config.rb