@headius Do you think that something like that looks like something sensible ? (I’m not a good Ruby dev) ```ruby # frozen_string_literal: true module Biz module Periods class Linear < SimpleDelegator class PrivateEnumerator _EMPTY_ARRAY = [].freeze def initialize(periods, shifts, selector) @periods = periods @shifts = shifts @inner_repr = Enumerator.new { |yielder| yield yielder } end def to_a while (next_p = @periods.next_values) && (next_s = @shifts.next_values) @periods.next if next_p @shifts.next if next_s end @inner_repr.to_a end def method_missing(m, *args, &block) @inner_repr.send(m, args, block) end end def initialize(periods, shifts, selector) @periods = periods @shifts = shifts @selector = selector @sequences = [@periods, @shifts] super(linear_periods) end private attr_reader :periods, :shifts, :selector, :sequences def linear_periods PrivateEnumerator.new(@periods, @shifts) do |yielder| loop do periods.next and next if periods.peek.date == shifts.peek.date yielder << begin sequences .public_send(selector) { |sequence| sequence.peek.date } .next end end loop do yielder << periods.next end end end end end end ```