klepto 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
data/lib/klepto/bot.rb CHANGED
@@ -63,9 +63,9 @@ EOS
63
63
  # This is here to debug, having a weird issue with getting a 200 and sometimes
64
64
  # returning @browser.failure? => true
65
65
  sleep_counter = 0
66
- while @browser.status.nil? && sleep_counter < @config.sleep_tries
66
+ while @browser.failure? && sleep_counter < @config.sleep_tries
67
67
  sleep_counter +=1
68
- sleep @config.sleep
68
+ sleep @config.sleep_time
69
69
  end
70
70
 
71
71
  # If the page was not a failure or if not aborting, structure that bad boy.
@@ -73,7 +73,7 @@ EOS
73
73
  @config.after_handlers[:abort].each {|ah| ah.call(@browser) }
74
74
  else
75
75
  @structure = __structure(@browser.page)
76
- end
76
+ end
77
77
  rescue Capybara::Poltergeist::TimeoutError => ex
78
78
  if @config.has_timeout_handler?
79
79
  @config.status_handler(:timeout).each{|th| th.call(ex, @browser, @config.url) }
data/lib/klepto/config.rb CHANGED
@@ -6,7 +6,7 @@ module Klepto
6
6
  def initialize
7
7
  @headers = {}
8
8
  @abort_on_failure = true
9
- @sleep = 0.5
9
+ @sleep_time = 0.5
10
10
  @sleep_tries = 10
11
11
  @abort_on_redirect = false
12
12
  @after_handlers = {
@@ -26,12 +26,14 @@ module Klepto
26
26
  # @handlers[group][handler].each{|handler| handler.call(*args)}
27
27
  # end
28
28
 
29
- def sleep(_sleep=nil)
30
- @sleep = _sleep
29
+ def sleep_time(_sleep_time=nil)
30
+ @sleep_time = _sleep_time if _sleep_time
31
+ @sleep_time
31
32
  end
32
33
 
33
34
  def sleep_tries(_sleep_tries=nil)
34
- @sleep_tries = _sleep_tries
35
+ @sleep_tries = _sleep_tries if _sleep_tries
36
+ @sleep_tries
35
37
  end
36
38
 
37
39
  def driver(_driver=nil)
@@ -1,3 +1,3 @@
1
1
  module Klepto
2
- VERSION = "0.6.8"
2
+ VERSION = "0.6.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: klepto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
4
+ version: 0.6.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: