Class: Decidim::Admin::UserGroupsEvaluation
- Inherits:
-
Query
- Object
- Query
- Decidim::Admin::UserGroupsEvaluation
- Defined in:
- app/queries/decidim/admin/user_groups_evaluation.rb
Overview
A class used to find the UserGroup’s by their evaluation state.
Class Method Summary collapse
-
.for(user_groups, query = nil, state = nil) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
Instance Method Summary collapse
-
#initialize(user_groups, query = nil, state = nil) ⇒ UserGroupsEvaluation
constructor
Initializes the class.
-
#query ⇒ Object
List the User groups by the diferent filters.
Constructor Details
#initialize(user_groups, query = nil, state = nil) ⇒ UserGroupsEvaluation
Initializes the class.
user_groups - the User groups that need to be filtered query - query to filter user group names state - evaluation state to be used as a filter
21 22 23 24 25 |
# File 'app/queries/decidim/admin/user_groups_evaluation.rb', line 21 def initialize(user_groups, query = nil, state = nil) @user_groups = user_groups @query = query @state = state end |
Class Method Details
.for(user_groups, query = nil, state = nil) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
user_groups - the initial User Group relation that needs to be filtered. query - query to filter user group names state - evaluation state to be used as a filter
12 13 14 |
# File 'app/queries/decidim/admin/user_groups_evaluation.rb', line 12 def self.for(user_groups, query = nil, state = nil) new(user_groups, query, state).query end |
Instance Method Details
#query ⇒ Object
List the User groups by the diferent filters.
28 29 30 31 32 |
# File 'app/queries/decidim/admin/user_groups_evaluation.rb', line 28 def query @user_groups = filter_by_search(@user_groups) @user_groups = filter_by_state(@user_groups) @user_groups end |