Class: Gitlab::Triage::CommandBuilders::LabelCommandBuilder
Instance Attribute Summary
#items, #network, #resource
Instance Method Summary
collapse
#content_string, #initialize, #separator
Instance Method Details
#build_command ⇒ Object
7
8
9
10
11
|
# File 'lib/gitlab/triage/command_builders/label_command_builder.rb', line 7
def build_command
ensure_labels_exist!
super
end
|
#ensure_labels_exist! ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/gitlab/triage/command_builders/label_command_builder.rb', line 15
def ensure_labels_exist!
items.each do |label|
source_id_key = resource.key?(:group_id) ? :group_id : :project_id
label_opts = {
source_id_key => resource[source_id_key],
name: label
}
unless Resource::Label.new(label_opts, network: network).exist?
raise Resource::Label::LabelDoesntExistError,
"Label `#{label}` doesn't exist!"
end
end
end
|
34
35
36
|
# File 'lib/gitlab/triage/command_builders/label_command_builder.rb', line 34
def format_item(item)
"~\"#{item}\""
end
|
#slash_command_string ⇒ Object
30
31
32
|
# File 'lib/gitlab/triage/command_builders/label_command_builder.rb', line 30
def slash_command_string
"/label"
end
|