diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-11-13 19:20:48 +0100 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-11-16 14:07:38 +0100 |
commit | 986695e136a8f6afa326048b30be77a9265d3bf7 (patch) | |
tree | 390e60bd0213b3c431094cfe71395be845b77714 /app/models/global_label.rb | |
parent | 05335a3c8584c48a9317bd0919eccee6948de742 (diff) | |
download | gitlab-ce-986695e136a8f6afa326048b30be77a9265d3bf7.tar.gz |
Refactor global and group milestones logic
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
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 |