class Gitlab::Triage::CommandBuilders::BaseCommandBuilder

Attributes

items[R]
network[R]
resource[R]

Public Class Methods

new(items, resource: nil, network: nil) click to toggle source
# File lib/gitlab/triage/command_builders/base_command_builder.rb, line 5
def initialize(items, resource: nil, network: nil)
  @items = Array.wrap(items)
  @items.delete('')
  @resource = resource&.with_indifferent_access
  @network = network
end

Public Instance Methods

build_command() click to toggle source
# File lib/gitlab/triage/command_builders/base_command_builder.rb, line 12
def build_command
  if items.any?
    [slash_command_string, content_string].compact.join(separator)
  else
    ""
  end
end

Private Instance Methods

content_string() click to toggle source
# File lib/gitlab/triage/command_builders/base_command_builder.rb, line 32
def content_string
  items.map do |item|
    format_item(item)
  end.join(separator)
end
separator() click to toggle source
# File lib/gitlab/triage/command_builders/base_command_builder.rb, line 24
def separator
  ' '
end
slash_command_string() click to toggle source
# File lib/gitlab/triage/command_builders/base_command_builder.rb, line 28
def slash_command_string
  nil
end