Sha256: a892bad36ab4373809b5f4f81c146e7880476aed5477f14afedb49eb3cca22d3

Contents?: true

Size: 876 Bytes

Versions: 2

Compression:

Stored size: 876 Bytes

Contents

# frozen_string_literal: true

require 'active_support/core_ext/hash/indifferent_access'
require 'tmpdir'

module Aranha
  module Selenium
    class DriverFactory
      class Base
        DEFAULT_DOWNLOADS_DIR = ::File.join(::Dir.tmpdir, 'aranha_downloads_dir')
        DEFAULT_ACCEPT_INSECURE_CERTS = false
        DEFAULT_HEADLESS = false

        attr_reader :options

        def initialize(options)
          @options = options.with_indifferent_access.freeze
        end

        def build
          raise 'Must be overrided'
        end

        def downloads_dir
          options[:downloads_dir] || DEFAULT_DOWNLOADS_DIR
        end

        def accept_insecure_certs?
          options[:accept_insecure_certs] || DEFAULT_ACCEPT_INSECURE_CERTS
        end

        def headless?
          options[:headless] || DEFAULT_HEADLESS
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aranha-0.9.1 lib/aranha/selenium/driver_factory/base.rb
aranha-0.9.0 lib/aranha/selenium/driver_factory/base.rb