Sha256: 5f34ee0ae8eee768847f94d55295939787c4a5eae2cc03529c3969dae7bb8495
Contents?: true
Size: 760 Bytes
Versions: 13
Compression:
Stored size: 760 Bytes
Contents
# encoding: utf-8 module Middleman module Presentation module Transformers # Group slides together class GroupSlides private attr_reader :template public def initialize(template:) @template = template end def transform(slides) groups = Set.new new_slides = slides.map do |slide| if slide.group && groups.none? { |g| g.name == slide.group } slide = group = SlideGroup.new name: slide.group, slides: slides.select { |s| s.group? slide.group }, template: template groups << group end slide end new_slides - groups.map(&:slides).flatten end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems