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
9
10
11
12
13
|
# File 'lib/gitlab/triage/command_builders/label_command_builder.rb', line 9
def build_command
ensure_labels_exist!
super
end
|
#ensure_labels_exist! ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/gitlab/triage/command_builders/label_command_builder.rb', line 17
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
|
36
37
38
|
# File 'lib/gitlab/triage/command_builders/label_command_builder.rb', line 36
def format_item(item)
"~\"#{item}\""
end
|
#slash_command_string ⇒ Object
32
33
34
|
# File 'lib/gitlab/triage/command_builders/label_command_builder.rb', line 32
def slash_command_string
"/label"
end
|