summaryrefslogtreecommitdiff
path: root/app/models/global_label.rb
blob: 0171f7d54b7d6a56157d4bdcd4a1b664aba71fd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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