gitlab-org--gitlab-foss/lib/gitlab/github_import/label_formatter.rb
2016-09-09 11:22:38 -03:00

33 lines
520 B
Ruby

module Gitlab
module GithubImport
class LabelFormatter < BaseFormatter
def attributes
{
project: project,
title: title,
color: color
}
end
def klass
Label
end
def create!
project.labels.find_or_create_by!(title: title) do |label|
label.color = color
end
end
private
def color
"##{raw_data.color}"
end
def title
raw_data.name
end
end
end
end