Sha256: 04b10d9481c4a42f5581b4b06834ae09e0e104a4d037a64a144a96daf20a04c2

Contents?: true

Size: 880 Bytes

Versions: 2

Compression:

Stored size: 880 Bytes

Contents

module Webdrone
  class Browser
    def conf
      @conf ||= Conf.new self
    end
  end

  class Conf
    attr_accessor :a0, :timeout, :outdir, :error, :developer

    def initialize(a0)
      @a0 = a0
      @outdir = "."
      @error = :raise_report
    end

    def timeout=(val)
      @timeout = val
      @a0.driver.manage.timeouts.implicit_wait = val
    rescue => exception
      Webdrone.report_error(@a0, exception, Kernel.caller_locations)
    end

    def outdir=(val)
      @outdir = val
      FileUtils.mkdir_p val
    rescue => exception
      Webdrone.report_error(@a0, exception, Kernel.caller_locations)
    end

    def error=(val)
      raise "Invalid value '#{val}' for error" if not [:raise_report, :raise, :ignore].include? val
      @error = val
    rescue => exception
      Webdrone.report_error(@a0, exception, Kernel.caller_locations)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webdrone-1.0.4 lib/webdrone/conf.rb
webdrone-1.0.0 lib/webdrone/conf.rb