Class: Ci::GroupVariablesFinder
- Inherits:
-
Object
- Object
- Ci::GroupVariablesFinder
- Defined in:
- app/finders/ci/group_variables_finder.rb
Constant Summary collapse
- SORT_TO_PARAMS_MAP =
{ created_desc: { order_by: 'created_at', sort: 'desc' }, created_asc: { order_by: 'created_at', sort: 'asc' }, key_desc: { order_by: 'key', sort: 'desc' }, key_asc: { order_by: 'key', sort: 'asc' } }.freeze
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project, sort_key = nil) ⇒ GroupVariablesFinder
constructor
A new instance of GroupVariablesFinder.
Constructor Details
#initialize(project, sort_key = nil) ⇒ GroupVariablesFinder
Returns a new instance of GroupVariablesFinder.
12 13 14 15 |
# File 'app/finders/ci/group_variables_finder.rb', line 12 def initialize(project, sort_key = nil) @project = project @params = sort_to_params_map(sort_key) end |
Instance Method Details
#execute ⇒ Object
17 18 19 20 21 22 23 |
# File 'app/finders/ci/group_variables_finder.rb', line 17 def execute variables = ::Ci::GroupVariable.for_groups(project.group&.self_and_ancestor_ids) return Ci::GroupVariable.none if variables.empty? sort(variables) end |