gitlab-org--gitlab-foss/lib/gitlab/cycle_analytics/base_stage.rb

25 lines
687 B
Ruby
Raw Normal View History

module Gitlab
module CycleAnalytics
class BaseStage
def initialize(project:, options:, stage: stage)
@project = project
@options = options
@fetcher = Gitlab::CycleAnalytics::MetricsFetcher.new(project: project,
from: options[:from],
branch: options[:branch])
@stage = stage
end
def events
event_class.new(fetcher: @fetcher, stage: @stage).fetch
end
private
def event_class
"Gitlab::CycleAnalytics::#{@stage.to_s.capitalize}Event".constantize
end
end
end
end