summaryrefslogtreecommitdiff
path: root/app/models/global_label.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/global_label.rb')
-rw-r--r--app/models/global_label.rb17
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