Sha256: fc705e38c16f31be4f7195ce76778f8af3177220ac387ff89e57fc3088861dbd
Contents?: true
Size: 654 Bytes
Versions: 1
Compression:
Stored size: 654 Bytes
Contents
#!/usr/bin/env ruby class Array # "Peels" off a tuple of the elements at each successive index across multiple arrays. # Assumes self is an array of these multiple arrays. Stops when any of the arrays is # exhausted. I stole this from a ruby mailing list somewhere. I also considered calling this each_tuple def peel(&p) collect { |a| a.length }.min.times { |i| yield collect { |a| a[i] } } end # syntactic sugar for Cipher def collect_peel(&p) collected = [] peel { |a,b| collected << p.call(a,b) } collected end end class Fixnum def offset_mod(base) ((self-1)%base)+1 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubyzip-0.9.1 | lib/quiz1/t/solutions/Moses Hohman/util.rb |