Sha256: cd295bb9d402aa6ad4b15da209dd65b732b8cea499186c46cf8b794ae1a0d765
Contents?: true
Size: 521 Bytes
Versions: 2
Compression:
Stored size: 521 Bytes
Contents
# frozen_string_literal: true module Blackcal class SlotMatrix def initialize(slots) @matrix = [[]] @slots = slots end # @return [Array<Array<Object>>] data def data @matrix end # Add value # @param [Object, nil] value def <<(value) array = @matrix[@matrix.length - 1] || [] # move to next slot when max slot length is reached if array.length >= @slots array = [] @matrix << array end array << value end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
blackcal-0.2.0 | lib/blackcal/slot_matrix.rb |
blackcal-0.1.0 | lib/blackcal/slot_matrix.rb |