Class: Gitlab::Triage::Policies::RulePolicy

Inherits:
BasePolicy
  • Object
show all
Defined in:
lib/gitlab/triage/policies/rule_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, #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_issue(resource) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/gitlab/triage/policies/rule_policy.rb', line 23

def build_issue(resource)
  action = actions.fetch(:issue, {})

  EntityBuilders::IssueBuilder.new(
    type: type,
    policy_spec: policy_spec,
    action: action,
    resource: resource,
    network: network)
end

#build_summaryObject

Build a summary from a single rule policy



12
13
14
15
16
17
18
19
20
21
# File 'lib/gitlab/triage/policies/rule_policy.rb', line 12

def build_summary
  action = actions.fetch(:summarize, {})

  EntityBuilders::SummaryBuilder.new(
    type: type,
    policy_spec: policy_spec,
    action: action,
    resources: resources,
    network: network)
end