Class: GoogleBrowse::Browser
- Inherits:
-
Object
- Object
- GoogleBrowse::Browser
- Defined in:
- lib/google_browse/browser.rb
Constant Summary collapse
- DEFAULT_RESULTS_PER_PAGE =
5
- MIN_RESULTS_PER_PAGE =
1
- MAX_RESULTS_PER_PAGE =
Avoid being rude to Google.
20
- NUM_COLUMNS =
79
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Browser
constructor
A new instance of Browser.
Constructor Details
#initialize(options = {}) ⇒ Browser
Returns a new instance of Browser.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/google_browse/browser.rb', line 19 def initialize( = {}) = { results_per_page: DEFAULT_RESULTS_PER_PAGE, }.merge! @results_per_page = [ [MIN_RESULTS_PER_PAGE, [:results_per_page]].max, MAX_RESULTS_PER_PAGE ].min @quit = false if [:query] @scraper = Scraper.new [:query] else @scraper = nil input_new_search end @page_number = 0 puts list_links navigate until quit? end |
Class Method Details
.search(*args) ⇒ Object
14 |
# File 'lib/google_browse/browser.rb', line 14 def search(*args); new *args; end |