Module: Scrubyt::FetchAction
- Included in:
- Extractor
- Defined in:
- lib/scrubyt/core/navigation/fetch_action.rb
Overview
Fetching pages (and related functionality)
Since lot of things are happening during (and before) the fetching of a document, I decided to move out fetching related functionality to a separate class - so if you are looking for anything which is loading a document (even by submitting a form or clicking a link) and related things like setting a proxy etc. you should find it here.
Constant Summary collapse
- @@current_doc_url =
nil
- @@current_doc_protocol =
nil
- @@base_dir =
nil
- @@host_name =
nil
- @@history =
[]
- @@current_form =
nil
Class Method Summary collapse
-
.get_current_doc_url ⇒ Object
At any given point, the current document can be queried with this method; Typically used when the navigation is over and the result document is passed to the wrapper.
- .get_hpricot_doc ⇒ Object
- .get_mechanize_doc ⇒ Object
Instance Method Summary collapse
- #get_host_name ⇒ Object
- #restore_host_name ⇒ Object
- #restore_page ⇒ Object
- #store_host_name(doc_url) ⇒ Object
- #store_page ⇒ Object
Class Method Details
.get_current_doc_url ⇒ Object
At any given point, the current document can be queried with this method; Typically used when the navigation is over and the result document is passed to the wrapper
21 22 23 |
# File 'lib/scrubyt/core/navigation/fetch_action.rb', line 21 def self.get_current_doc_url @@current_doc_url end |
.get_hpricot_doc ⇒ Object
29 30 31 |
# File 'lib/scrubyt/core/navigation/fetch_action.rb', line 29 def self.get_hpricot_doc @@hpricot_doc end |
.get_mechanize_doc ⇒ Object
25 26 27 |
# File 'lib/scrubyt/core/navigation/fetch_action.rb', line 25 def self.get_mechanize_doc @@mechanize_doc end |
Instance Method Details
#get_host_name ⇒ Object
33 34 35 |
# File 'lib/scrubyt/core/navigation/fetch_action.rb', line 33 def get_host_name @@host_name end |
#restore_host_name ⇒ Object
37 38 39 40 |
# File 'lib/scrubyt/core/navigation/fetch_action.rb', line 37 def restore_host_name return if @@current_doc_protocol == 'file' @@host_name = @@original_host_name end |
#restore_page ⇒ Object
46 47 48 |
# File 'lib/scrubyt/core/navigation/fetch_action.rb', line 46 def restore_page @@hpricot_doc = @@history.pop end |
#store_host_name(doc_url) ⇒ Object
50 51 52 |
# File 'lib/scrubyt/core/navigation/fetch_action.rb', line 50 def store_host_name(doc_url) FetchAction.store_host_name(doc_url) end |
#store_page ⇒ Object
42 43 44 |
# File 'lib/scrubyt/core/navigation/fetch_action.rb', line 42 def store_page @@history.push @@hpricot_doc end |