Sha256: 17c72bc0c63f1f2727bece8ce889db2d215417298f8334ab712f5c6bab43f1d3
Contents?: true
Size: 927 Bytes
Versions: 1
Compression:
Stored size: 927 Bytes
Contents
require 'open-uri' require 'Hpricot' require 'craigler/constants' require 'craigler/search' module Craigler class CraiglerError < StandardError; end class InvalidCategory < CraiglerError; end class InvalidSearchTerm < CraiglerError; end class InvalidLocation < CraiglerError; end class << self # Interface to Search that may or may not be more readable def search(category, options = {}) options = { :only => category }.merge(options) results = Search.new(options.delete(:for), options).results() results.each {|result| yield(result) } if block_given? results end # Interface to Search that somewhat mimics ActiveRecord#find # # Supports all the options of Search#new def find(search_term, options = {}) results = Search.new(search_term, options).results() results.each {|result| yield(result) } if block_given? results end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
quixoten-craigler-1.2.0 | lib/craigler.rb |