diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2015-12-08 12:35:54 +0100 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2015-12-08 12:35:54 +0100 |
commit | 6d2be0212c444c6a3d25ae6a3c75822fa1c8614f (patch) | |
tree | 66c12a4f7863ded395300a56de689b5cb669e84b /app/models/global_label.rb | |
parent | ad37f58ebd97fee3c06a531e4067c8adb4c9ecc7 (diff) | |
parent | f5430e48b42227f1c1874ca27c6907f0f704be28 (diff) | |
download | gitlab-ce-6d2be0212c444c6a3d25ae6a3c75822fa1c8614f.tar.gz |
Merge branch 'master' into sync-all-repos
Diffstat (limited to 'app/models/global_label.rb')
-rw-r--r-- | app/models/global_label.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/models/global_label.rb b/app/models/global_label.rb new file mode 100644 index 00000000000..0171f7d54b7 --- /dev/null +++ b/app/models/global_label.rb @@ -0,0 +1,17 @@ +class GlobalLabel + attr_accessor :title, :labels + alias_attribute :name, :title + + def self.build_collection(labels) + labels = labels.group_by(&:title) + + labels.map do |title, label| + new(title, label) + end + end + + def initialize(title, labels) + @title = title + @labels = labels + end +end |