Class: Gitlab::Triage::Policies::SummaryPolicy

Inherits:
BasePolicy
  • Object
show all
Defined in:
lib/gitlab/triage/policies/summary_policy.rb

Constant Summary

Constants inherited from BasePolicy

BasePolicy::InvalidPolicyError

Instance Attribute Summary

Attributes inherited from BasePolicy

#network, #policy_spec, #resources, #summary, #type

Instance Method Summary collapse

Methods inherited from BasePolicy

#actions, #build_issue, #comment?, #comment_on_summary?, #delete?, #initialize, #issue?, #name, #source, #source_id_sym, #summarize?, #validate!

Constructor Details

This class inherits a constructor from Gitlab::Triage::Policies::BasePolicy

Instance Method Details

#build_summaryObject

Build a summary from several rules policies



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/gitlab/triage/policies/summary_policy.rb', line 11

def build_summary
  action = actions[:summarize]
  issues = resources.map do |inner_policy_spec, inner_resources|
    Policies::RulePolicy.new(
      type, inner_policy_spec, inner_resources, network)
      .build_summary
  end

  EntityBuilders::SummaryBuilder.new(
    type: type,
    action: action,
    resources: issues.select(&:any_resources?),
    network: network,
    separator: "\n\n")
end