Module: Craigler
- Defined in:
- lib/craigler.rb,
lib/craigler/search.rb,
lib/craigler/version.rb,
lib/craigler/constants.rb
Defined Under Namespace
Classes: CraiglerError, InvalidCategory, InvalidLocation, InvalidSearchTerm, Search
Constant Summary collapse
- VERSION =
"1.3.3"
- RESULTS_PER_PAGE =
25
Class Method Summary collapse
-
.find(search_term, options = {}) ⇒ Object
Wrapper for Search#initialize.
-
.search(category, options = {}) ⇒ Object
Alternate interface to Search#initialize.
Class Method Details
.find(search_term, options = {}) ⇒ Object
Wrapper for Craigler::Search#initialize
28 29 30 31 32 |
# File 'lib/craigler.rb', line 28 def find(search_term, = {}) results = Search.new(search_term, ).results() results.each {|result| yield(result) } if block_given? results end |
.search(category, options = {}) ⇒ Object
Alternate interface to Craigler::Search#initialize
18 19 20 21 22 23 |
# File 'lib/craigler.rb', line 18 def search(category, = {}) = .merge({ :only => category }) results = Search.new(.delete(:for), ).results() results.each {|result| yield(result) } if block_given? results end |