Class: Mbanker::PersistentCrawler
- Inherits:
-
Object
- Object
- Mbanker::PersistentCrawler
- Defined in:
- lib/mbanker/persistent_crawler.rb
Instance Method Summary collapse
- #can_find?(selector) ⇒ Boolean
- #click(link_or_button) ⇒ Object
- #extract_text(selector) ⇒ Object
- #extract_texts(selector) ⇒ Object
- #find_first(selector) ⇒ Object
- #get_form ⇒ Object
-
#initialize(crawler, authenticater) ⇒ PersistentCrawler
constructor
A new instance of PersistentCrawler.
- #search(selector) ⇒ Object
- #visit(path_name) ⇒ Object
Constructor Details
#initialize(crawler, authenticater) ⇒ PersistentCrawler
Returns a new instance of PersistentCrawler.
4 5 6 7 8 9 |
# File 'lib/mbanker/persistent_crawler.rb', line 4 def initialize crawler, authenticater @crawler, @authenticator = crawler, authenticater if @authenticator.authenticated? @authenticator.authenticate! end end |
Instance Method Details
#can_find?(selector) ⇒ Boolean
31 32 33 |
# File 'lib/mbanker/persistent_crawler.rb', line 31 def can_find? selector @crawler.can_find? selector end |
#click(link_or_button) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/mbanker/persistent_crawler.rb', line 19 def click @crawler.click unless @authenticator.session_error_absent? @authenticator.authenticate! @crawler.visit end end |
#extract_text(selector) ⇒ Object
39 40 41 |
# File 'lib/mbanker/persistent_crawler.rb', line 39 def extract_text selector @crawler.extract_text selector end |
#extract_texts(selector) ⇒ Object
43 44 45 |
# File 'lib/mbanker/persistent_crawler.rb', line 43 def extract_texts selector @crawler.extract_texts selector end |
#find_first(selector) ⇒ Object
35 36 37 |
# File 'lib/mbanker/persistent_crawler.rb', line 35 def find_first selector @crawler.find_first selector end |
#get_form ⇒ Object
47 48 49 |
# File 'lib/mbanker/persistent_crawler.rb', line 47 def get_form @crawler.get_form end |
#search(selector) ⇒ Object
27 28 29 |
# File 'lib/mbanker/persistent_crawler.rb', line 27 def search selector @crawler.search selector end |
#visit(path_name) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/mbanker/persistent_crawler.rb', line 11 def visit path_name @crawler.visit path_name unless @authenticator.session_error_absent? @authenticator.authenticate! @crawler.visit path_name end end |