Class: Gitlab::Triage::EntityBuilders::IssueBuilder
- Inherits:
-
Object
- Object
- Gitlab::Triage::EntityBuilders::IssueBuilder
- Defined in:
- lib/gitlab/triage/entity_builders/issue_builder.rb
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
Instance Method Summary collapse
- #build_text(template) ⇒ Object private
- #description ⇒ Object
-
#initialize(type:, action:, resource:, network:, policy_spec: {}, separator: "\n") ⇒ IssueBuilder
constructor
A new instance of IssueBuilder.
- #title ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(type:, action:, resource:, network:, policy_spec: {}, separator: "\n") ⇒ IssueBuilder
Returns a new instance of IssueBuilder.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gitlab/triage/entity_builders/issue_builder.rb', line 11 def initialize( type:, action:, resource:, network:, policy_spec: {}, separator: "\n") @type = type @policy_spec = policy_spec @item_template = action[:item] @title_template = action[:title] @description_template = action[:description] @destination = action[:destination] @redact_confidentials = action[:redact_confidential_resources] != false @resource = resource @network = network @separator = separator end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
9 10 11 |
# File 'lib/gitlab/triage/entity_builders/issue_builder.rb', line 9 def destination @destination end |
Instance Method Details
#build_text(template) ⇒ Object (private)
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/gitlab/triage/entity_builders/issue_builder.rb', line 41 def build_text(template) return '' unless template CommandBuilders::TextContentBuilder.new( template, resource: @resource, network: @network, redact_confidentials: @redact_confidentials) .build_command.chomp end |
#description ⇒ Object
31 32 33 |
# File 'lib/gitlab/triage/entity_builders/issue_builder.rb', line 31 def description @description ||= build_text(@description_template) end |
#title ⇒ Object
27 28 29 |
# File 'lib/gitlab/triage/entity_builders/issue_builder.rb', line 27 def title @title ||= build_text(@title_template) end |
#valid? ⇒ Boolean
35 36 37 |
# File 'lib/gitlab/triage/entity_builders/issue_builder.rb', line 35 def valid? title =~ /\S+/ end |