Class: Sequel::Dataset

Inherits:
Object
  • Object
show all
Defined in:
lib/sequel/extensions/restful_query.rb

Instance Method Summary collapse

Instance Method Details

#restful_query(query_hash, options = {}) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/sequel/extensions/restful_query.rb', line 16

def restful_query(query_hash, options = {})
  parser = RestfulQuery::Parser.new(query_hash, options = {})
  collection = self
  collection = collection.filter(*parser.to_conditions_array) if parser.has_conditions?
  collection = collection.order(*parser.sorts.collect {|s| s.to_sequel }) if parser.has_sort?
  collection
end