Class: Ci::PipelineSchedulesFinder

Inherits:
Object
  • Object
show all
Defined in:
app/finders/ci/pipeline_schedules_finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ PipelineSchedulesFinder

Returns a new instance of PipelineSchedulesFinder.


7
8
9
10
# File 'app/finders/ci/pipeline_schedules_finder.rb', line 7

def initialize(project)
  @project = project
  @pipeline_schedules = project.pipeline_schedules
end

Instance Attribute Details

#pipeline_schedulesObject (readonly)

Returns the value of attribute pipeline_schedules


5
6
7
# File 'app/finders/ci/pipeline_schedules_finder.rb', line 5

def pipeline_schedules
  @pipeline_schedules
end

#projectObject (readonly)

Returns the value of attribute project


5
6
7
# File 'app/finders/ci/pipeline_schedules_finder.rb', line 5

def project
  @project
end

Instance Method Details

#execute(scope: nil) ⇒ Object

rubocop: disable CodeReuse/ActiveRecord


13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/finders/ci/pipeline_schedules_finder.rb', line 13

def execute(scope: nil)
  scoped_schedules =
    case scope
    when 'active'
      pipeline_schedules.active
    when 'inactive'
      pipeline_schedules.inactive
    else
      pipeline_schedules
    end

  scoped_schedules.order(id: :desc)
end