Class: Analytics::CycleAnalytics::ProjectLevel

Inherits:
Object
  • Object
show all
Defined in:
app/models/analytics/cycle_analytics/project_level.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project:, options:) ⇒ ProjectLevel

Returns a new instance of ProjectLevel.


8
9
10
11
# File 'app/models/analytics/cycle_analytics/project_level.rb', line 8

def initialize(project:, options:)
  @project = project
  @options = options.merge(project: project)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.


6
7
8
# File 'app/models/analytics/cycle_analytics/project_level.rb', line 6

def options
  @options
end

#projectObject (readonly)

Returns the value of attribute project.


6
7
8
# File 'app/models/analytics/cycle_analytics/project_level.rb', line 6

def project
  @project
end

Instance Method Details

#[](stage_name) ⇒ Object


29
30
31
# File 'app/models/analytics/cycle_analytics/project_level.rb', line 29

def [](stage_name)
  ::CycleAnalytics::ProjectLevelStageAdapter.new(build_stage(stage_name), options)
end

#permissions(user:) ⇒ Object


19
20
21
# File 'app/models/analytics/cycle_analytics/project_level.rb', line 19

def permissions(user:)
  Gitlab::CycleAnalytics::Permissions.get(user: user, project: project)
end

#statsObject


23
24
25
26
27
# File 'app/models/analytics/cycle_analytics/project_level.rb', line 23

def stats
  @stats ||= default_stage_names.map do |stage_name|
    self[stage_name].as_json
  end
end

#summaryObject


13
14
15
16
17
# File 'app/models/analytics/cycle_analytics/project_level.rb', line 13

def summary
  @summary ||= ::Gitlab::CycleAnalytics::StageSummary.new(project,
                                                          options: options,
                                                          current_user: options[:current_user]).data
end