Class: Adauth::SearchResults

Inherits:
Array
  • Object
show all
Defined in:
lib/adauth/search_results.rb

Instance Method Summary collapse

Instance Method Details

#limit(x) ⇒ Object



3
4
5
# File 'lib/adauth/search_results.rb', line 3

def limit(x)
  return self[0..(x-1)]
end

#order(field, direction = :asc) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/adauth/search_results.rb', line 7

def order(field, direction = :asc)
  case direction
  when :asc
    return sort! { |x, y| x.send(field) <=> y.send(field) }
  when :desc
    return order(field, :asc).reverse!
  else
    raise "Invalid Order Provided, please use :asc or :desc"
  end
end