Class: WinewooCore::Repositories::Mongo::Queries::UserQuery

Inherits:
WinewooQuery
  • Object
show all
Defined in:
lib/winewoo_core/repositories/mongo/queries/user_query.rb

Instance Method Summary collapse

Methods inherited from WinewooQuery

#method_missing, #respond_to?, #respond_to_missing?

Constructor Details

#initialize(relation = User) ⇒ UserQuery

Returns a new instance of UserQuery.



5
6
7
# File 'lib/winewoo_core/repositories/mongo/queries/user_query.rb', line 5

def initialize(relation = User)
  super relation
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class WinewooCore::Repositories::Mongo::Queries::WinewooQuery

Instance Method Details

#with_role(role) ⇒ Object



10
11
12
13
# File 'lib/winewoo_core/repositories/mongo/queries/user_query.rb', line 10

def with_role(role)
  @relation = @relation.where(user_roles: role)
  block_given? ? @relation.each { |user| yield user } : self
end