diff options
Diffstat (limited to 'lib/gitlab/cycle_analytics/base_stage.rb')
-rw-r--r-- | lib/gitlab/cycle_analytics/base_stage.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/gitlab/cycle_analytics/base_stage.rb b/lib/gitlab/cycle_analytics/base_stage.rb new file mode 100644 index 00000000000..70f1e1018c9 --- /dev/null +++ b/lib/gitlab/cycle_analytics/base_stage.rb @@ -0,0 +1,24 @@ +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 |