class Sass::Selector::Sequence
def chunks(seq1, seq2)
-
(Array
- All possible orderings of the initial subsequences.)
Other tags:
- Yieldreturn: - Whether or not to cut off the initial subsequence
Other tags:
- Yieldparam: a - A final subsequence of one input sequence after
Other tags:
- Yield: - Used to determine when to cut off the initial subsequences.
Parameters:
-
seq2
(Array
) -- -
seq1
(Array
) --
def chunks(seq1, seq2) chunk1 = [] chunk1 << seq1.shift until yield seq1 chunk2 = [] chunk2 << seq2.shift until yield seq2 return [] if chunk1.empty? && chunk2.empty? return [chunk2] if chunk1.empty? return [chunk1] if chunk2.empty? [chunk1 + chunk2, chunk2 + chunk1] end