Module: Goodyear::FinderMethods
- Included in:
- QueryMethods
- Defined in:
- lib/goodyear/finder_methods.rb
Instance Method Summary collapse
- #all ⇒ Object
- #fields(*f) ⇒ Object
- #first ⇒ Object
- #highlight(fields) ⇒ Object
- #last ⇒ Object
- #size(size) ⇒ Object
- #sort(*sort_order) ⇒ Object (also: #order)
- #where(*query) ⇒ Object
Instance Method Details
#all ⇒ Object
39 40 41 |
# File 'lib/goodyear/finder_methods.rb', line 39 def all self.size(9999).fetch end |
#fields(*f) ⇒ Object
8 9 10 11 12 |
# File 'lib/goodyear/finder_methods.rb', line 8 def fields(*f) @_fields ||= [] @_fields = f.collect(&:to_s) return self end |
#first ⇒ Object
30 31 32 33 |
# File 'lib/goodyear/finder_methods.rb', line 30 def first self.size(1) #maybe more performant? self.fetch.first end |
#highlight(fields) ⇒ Object
25 26 27 28 |
# File 'lib/goodyear/finder_methods.rb', line 25 def highlight(fields) @_highlights = fields return self end |
#last ⇒ Object
35 36 37 |
# File 'lib/goodyear/finder_methods.rb', line 35 def last self.size(1).fetch.results.last end |
#size(size) ⇒ Object
14 15 16 17 |
# File 'lib/goodyear/finder_methods.rb', line 14 def size(size) @_size = size return self end |
#sort(*sort_order) ⇒ Object Also known as: order
19 20 21 22 |
# File 'lib/goodyear/finder_methods.rb', line 19 def sort(*sort_order) @_sort = sort_order.compact return self end |
#where(*query) ⇒ Object
3 4 5 6 |
# File 'lib/goodyear/finder_methods.rb', line 3 def where(*query) serialize_arguments(query) return self end |