lib/searchjoy/track.rb in searchjoy-0.0.9 vs lib/searchjoy/track.rb in searchjoy-0.0.10

- old
+ new

@@ -1,14 +1,15 @@ module Searchjoy module Track - def search_with_track(term, options = {}) - results = search_without_track(term, options) + def search_with_track(term, options = {}, &block) + results = search_without_track(term, options) do |body| + block.call(body) if block + end if options[:track] attributes = options[:track] == true ? {} : options[:track] results.search = Searchjoy::Search.create({search_type: name, query: term, results_count: results.total_count}.merge(attributes)) end - results end end end