Skip to content

Instantly share code, notes, and snippets.

def Array.toy(n=10,&block)
if block_given?
new(n, &block)
else
new(n) {|i| i+1}
end
end
def Hash.toy(n=10)
Hash[Array.toy(n).zip(Array.toy(n){|c| (96+(c+1)).chr})]