Class: Capybara::Webkit::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/capybara/webkit/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/capybara/webkit/configuration.rb', line 35

def initialize
  @allowed_urls = []
  @blocked_urls = []
  @block_unknown_urls = false
  @debug = false
  @ignore_ssl_errors = false
  @proxy = nil
  @skip_image_loading = false
  @stderr = $stderr
  @timeout = -1
  @raise_javascript_errors = false
end

Instance Attribute Details

#allowed_urlsObject

Returns the value of attribute allowed_urls.



24
25
26
# File 'lib/capybara/webkit/configuration.rb', line 24

def allowed_urls
  @allowed_urls
end

#block_unknown_urlsObject



56
57
58
# File 'lib/capybara/webkit/configuration.rb', line 56

def block_unknown_urls
  @block_unknown_urls = true
end

#blocked_urlsObject

Returns the value of attribute blocked_urls.



26
27
28
# File 'lib/capybara/webkit/configuration.rb', line 26

def blocked_urls
  @blocked_urls
end

#debugObject

Returns the value of attribute debug.



27
28
29
# File 'lib/capybara/webkit/configuration.rb', line 27

def debug
  @debug
end

#ignore_ssl_errorsObject



68
69
70
# File 'lib/capybara/webkit/configuration.rb', line 68

def ignore_ssl_errors
  @ignore_ssl_errors = true
end

#proxyObject

Returns the value of attribute proxy.



29
30
31
# File 'lib/capybara/webkit/configuration.rb', line 29

def proxy
  @proxy
end

#raise_javascript_errorsObject

Returns the value of attribute raise_javascript_errors.



33
34
35
# File 'lib/capybara/webkit/configuration.rb', line 33

def raise_javascript_errors
  @raise_javascript_errors
end

#skip_image_loadingObject



76
77
78
# File 'lib/capybara/webkit/configuration.rb', line 76

def skip_image_loading
  @skip_image_loading = true
end

#stderrObject

Returns the value of attribute stderr.



30
31
32
# File 'lib/capybara/webkit/configuration.rb', line 30

def stderr
  @stderr
end

#timeoutObject

Returns the value of attribute timeout.



31
32
33
# File 'lib/capybara/webkit/configuration.rb', line 31

def timeout
  @timeout
end

Class Method Details

.modifyObject



16
17
18
19
20
21
22
# File 'lib/capybara/webkit/configuration.rb', line 16

def self.modify
  if instance.frozen?
    raise "All configuration must take place before the driver starts"
  else
    yield instance
  end
end

.to_hashObject



12
13
14
# File 'lib/capybara/webkit/configuration.rb', line 12

def self.to_hash
  instance.freeze.to_hash
end

Instance Method Details

#allow_unknown_urlsObject



64
65
66
# File 'lib/capybara/webkit/configuration.rb', line 64

def allow_unknown_urls
  allow_url("*")
end

#allow_url(url) ⇒ Object



48
49
50
# File 'lib/capybara/webkit/configuration.rb', line 48

def allow_url(url)
  @allowed_urls << url
end

#block_unknown_urls?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/capybara/webkit/configuration.rb', line 60

def block_unknown_urls?
  @block_unknown_urls
end

#block_url(url) ⇒ Object



52
53
54
# File 'lib/capybara/webkit/configuration.rb', line 52

def block_url(url)
  @blocked_urls << url
end

#ignore_ssl_errors?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/capybara/webkit/configuration.rb', line 72

def ignore_ssl_errors?
  @ignore_ssl_errors
end

#skip_image_loading?Boolean

Returns:

  • (Boolean)


80
81
82
# File 'lib/capybara/webkit/configuration.rb', line 80

def skip_image_loading?
  @skip_image_loading
end

#to_hashObject



88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/capybara/webkit/configuration.rb', line 88

def to_hash
  {
    allowed_urls: allowed_urls,
    block_unknown_urls: block_unknown_urls?,
    blocked_urls: blocked_urls,
    debug: debug,
    ignore_ssl_errors: ignore_ssl_errors?,
    proxy: proxy,
    skip_image_loading: skip_image_loading?,
    stderr: stderr,
    timeout: timeout,
    raise_javascript_errors: raise_javascript_errors,
  }
end

#use_proxy(proxy) ⇒ Object



84
85
86
# File 'lib/capybara/webkit/configuration.rb', line 84

def use_proxy(proxy)
  @proxy = proxy
end