module Goodyear::FinderMethods

Public Instance Methods

all() click to toggle source
# File lib/goodyear/finder_methods.rb, line 39
def all
  self.size(9999).fetch
end
fields(*f) click to toggle source
# File lib/goodyear/finder_methods.rb, line 8
def fields(*f)
  @_fields ||= []
  @_fields = f.collect(&:to_s)
  return self
end
first() click to toggle source
# File lib/goodyear/finder_methods.rb, line 30
def first
  self.size(1) #maybe more performant?
  self.fetch.first
end
highlight(fields) click to toggle source
# File lib/goodyear/finder_methods.rb, line 25
def highlight(fields)
  @_highlights = fields
  return self
end
last() click to toggle source
# File lib/goodyear/finder_methods.rb, line 35
def last
  self.size(1).fetch.results.last
end
order(*sort_order)
Alias for: sort
size(size) click to toggle source
# File lib/goodyear/finder_methods.rb, line 14
def size(size)
  @_size = size
  return self
end
sort(*sort_order) click to toggle source
# File lib/goodyear/finder_methods.rb, line 19
def sort(*sort_order)
  @_sort = sort_order.compact
  return self
end
Also aliased as: order
where(*query) click to toggle source
# File lib/goodyear/finder_methods.rb, line 3
def where(*query)
  serialize_arguments(query)
  return self
end

Protected Instance Methods

add_query_segment() click to toggle source
# File lib/goodyear/finder_methods.rb, line 44
def add_query_segment
  @query_segments ||= []
  @query_segments << @_and
  @_and = []
end

Private Instance Methods

serialize_arguments(q) click to toggle source
# File lib/goodyear/finder_methods.rb, line 51
def serialize_arguments(q)
  @_and ||= []
  q.each do |arg|
    arg.each_pair { |k,v|  @_and << "#{k}:#{v}" } if arg.class == Hash
    @_and << arg if arg.class == String
  end
end