Class: Capybara::Apparition::Configuration
- Inherits:
-
Object
- Object
- Capybara::Apparition::Configuration
- Defined in:
- lib/capybara/apparition/configuration.rb
Instance Attribute Summary collapse
-
#allowed_urls ⇒ Object
Returns the value of attribute allowed_urls.
- #block_unknown_urls ⇒ Object
-
#blocked_urls ⇒ Object
Returns the value of attribute blocked_urls.
-
#debug ⇒ Object
Returns the value of attribute debug.
- #ignore_ssl_errors ⇒ Object
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#raise_javascript_errors ⇒ Object
Returns the value of attribute raise_javascript_errors.
- #skip_image_loading ⇒ Object
-
#stderr ⇒ Object
Returns the value of attribute stderr.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Class Method Summary collapse
Instance Method Summary collapse
- #allow_unknown_urls ⇒ Object
- #allow_url(url) ⇒ Object
- #block_unknown_urls? ⇒ Boolean
- #block_url(url) ⇒ Object
- #ignore_ssl_errors? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #skip_image_loading? ⇒ Boolean
- #to_hash ⇒ Object
- #use_proxy(proxy) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/capybara/apparition/configuration.rb', line 32 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_urls ⇒ Object
Returns the value of attribute allowed_urls.
21 22 23 |
# File 'lib/capybara/apparition/configuration.rb', line 21 def allowed_urls @allowed_urls end |
#block_unknown_urls ⇒ Object
53 54 55 |
# File 'lib/capybara/apparition/configuration.rb', line 53 def block_unknown_urls @block_unknown_urls = true end |
#blocked_urls ⇒ Object
Returns the value of attribute blocked_urls.
23 24 25 |
# File 'lib/capybara/apparition/configuration.rb', line 23 def blocked_urls @blocked_urls end |
#debug ⇒ Object
Returns the value of attribute debug.
24 25 26 |
# File 'lib/capybara/apparition/configuration.rb', line 24 def debug @debug end |
#ignore_ssl_errors ⇒ Object
65 66 67 |
# File 'lib/capybara/apparition/configuration.rb', line 65 def ignore_ssl_errors @ignore_ssl_errors = true end |
#proxy ⇒ Object
Returns the value of attribute proxy.
26 27 28 |
# File 'lib/capybara/apparition/configuration.rb', line 26 def proxy @proxy end |
#raise_javascript_errors ⇒ Object
Returns the value of attribute raise_javascript_errors.
30 31 32 |
# File 'lib/capybara/apparition/configuration.rb', line 30 def raise_javascript_errors @raise_javascript_errors end |
#skip_image_loading ⇒ Object
73 74 75 |
# File 'lib/capybara/apparition/configuration.rb', line 73 def skip_image_loading @skip_image_loading = true end |
#stderr ⇒ Object
Returns the value of attribute stderr.
27 28 29 |
# File 'lib/capybara/apparition/configuration.rb', line 27 def stderr @stderr end |
#timeout ⇒ Object
Returns the value of attribute timeout.
28 29 30 |
# File 'lib/capybara/apparition/configuration.rb', line 28 def timeout @timeout end |
Class Method Details
.modify ⇒ Object
17 18 19 |
# File 'lib/capybara/apparition/configuration.rb', line 17 def self.modify raise 'All configuration must take place before the driver starts' if instance.frozen? end |
.to_hash ⇒ Object
13 14 15 |
# File 'lib/capybara/apparition/configuration.rb', line 13 def self.to_hash instance.freeze.to_hash end |
Instance Method Details
#allow_unknown_urls ⇒ Object
61 62 63 |
# File 'lib/capybara/apparition/configuration.rb', line 61 def allow_unknown_urls allow_url('*') end |
#allow_url(url) ⇒ Object
45 46 47 |
# File 'lib/capybara/apparition/configuration.rb', line 45 def allow_url(url) @allowed_urls << url end |
#block_unknown_urls? ⇒ Boolean
57 58 59 |
# File 'lib/capybara/apparition/configuration.rb', line 57 def block_unknown_urls? @block_unknown_urls end |
#block_url(url) ⇒ Object
49 50 51 |
# File 'lib/capybara/apparition/configuration.rb', line 49 def block_url(url) @blocked_urls << url end |
#ignore_ssl_errors? ⇒ Boolean
69 70 71 |
# File 'lib/capybara/apparition/configuration.rb', line 69 def ignore_ssl_errors? @ignore_ssl_errors end |
#skip_image_loading? ⇒ Boolean
77 78 79 |
# File 'lib/capybara/apparition/configuration.rb', line 77 def skip_image_loading? @skip_image_loading end |
#to_hash ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/capybara/apparition/configuration.rb', line 85 def to_hash { url_whitelist: allowed_urls, block_unknown_urls: block_unknown_urls?, url_blacklist: blocked_urls, debug: debug, ignore_ssl_errors: ignore_ssl_errors?, proxy: proxy, skip_image_loading: skip_image_loading?, stderr: stderr, timeout: timeout, js_errors: raise_javascript_errors } end |
#use_proxy(proxy) ⇒ Object
81 82 83 |
# File 'lib/capybara/apparition/configuration.rb', line 81 def use_proxy(proxy) @proxy = proxy end |