class WinewooCore::Repositories::Mongo::Queries::InterproQuery

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/winewoo_core/repositories/mongo/queries/interpro_query.rb, line 5
def initialize
  super User.where(user_roles: :interpro)
end

Public Instance Methods

without_wines(interpro_id) { |user| ... } click to toggle source
# File lib/winewoo_core/repositories/mongo/queries/interpro_query.rb, line 10
def without_wines(interpro_id)
  wine_ids = WinewooCore::Repositories::Mongo::Queries::WineQuery
    .new
    .from_interpro(interpro_id)
    .map(&:interpro_id)

  @relation = @relation
    .where(:_id.nin => wine_ids)

  block_given? ?
    @relation.each { |user| yield user } :
    self
end