Method: Doing::WWID#tag_groups

Defined in:
lib/doing/wwid/tags.rb

#tag_groups(items, opt: {}) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/doing/wwid/tags.rb', line 39

def tag_groups(items, opt: {})
  all_items = filter_items(items, opt: opt)
  tags = all_tags(all_items, opt: {})
  groups = {}
  tags.each do |tag|
    groups[tag] ||= []
    groups[tag] = filter_items(all_items, opt: { tag: tag, tag_bool: :or })
  end

  groups
end