Sha256: 78faa353fd4a4df95b1671dc7812d261bb88392a7d182ab442f381f389ecb756
Contents?: true
Size: 643 Bytes
Versions: 9
Compression:
Stored size: 643 Bytes
Contents
module Cascadence module Helper # see the specs for what these guys do def self.generate_tributary( arrays, starts=[], finish=[] ) if starts.empty? || arrays.count == 1 return arrays.reverse.flatten end generate_tributary arrays.push(replace_in_part(arrays.pop, arrays.pop, starts.pop, finish.pop) ), starts, finish end def self.replace_in_part(original, chunk, start, finish=nil) return chunk if original.nil? || original.empty? throw :OutOfRange if start >= original.count result = original.clone result[start..(finish||-1)] = chunk return result end end end
Version data entries
9 entries across 9 versions & 1 rubygems