module Gimlet::Queryable::API

Public Instance Methods

new_query() click to toggle source
# File lib/gimlet/queryable.rb, line 18
def new_query
  current_scope || Query.new(self)
end
select(options = {}) click to toggle source
# File lib/gimlet/queryable.rb, line 8
def select(options = {})
  selecting = @instances
  options[:where].each do |attribute, operator, argument|
    selecting = selecting.select do |id, instance|
      instance[attribute].send(operator, argument)
    end
  end
  selecting.values
end