Sha256: 46c273f93b10af06496eb91bbaf4f898472e1a9e5533fbc441e35c51f83738d4
Contents?: true
Size: 973 Bytes
Versions: 5
Compression:
Stored size: 973 Bytes
Contents
require_relative '../collection' module Hungry class Venue class Collection < Hungry::Collection include Pagination def search(query) all query: query end def nearby(location, options = {}) options[:geolocation] = Geolocation.parse(location) options[:sort_by] ||= 'distance' all options end def tagged_with(*tags) all tags: (current_tags + tags.flatten).compact.join(',') end def maintainable_by(user_or_id) user_id = user_or_id.to_s =~ /^[0-9]+$/ ? user_or_id.to_i : user_or_id.id all maintainer_id: user_id end def sort_by(subject) all sort_by: subject end private def current_tags if criteria[:tags].is_a?(String) criteria[:tags].gsub(/\s+/, '') .split(',') else criteria[:tags] || [] end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems