Sha256: 63ca1f4291f456fade255df1a2bfa69ac1b4322f71f1f92fb6bad7755c928365
Contents?: true
Size: 495 Bytes
Versions: 4
Compression:
Stored size: 495 Bytes
Contents
# Copyright: Copyright (c) 2004 Nicolas Despres. All rights reserved. # Author: Nicolas Despres <polrop@lrde.epita.fr>. # License: Gnu General Public License. # $LastChangedBy: polrop $ # $Id: cache.rb 173 2005-03-29 09:41:46Z polrop $ class Array # Basically, do the same as each_with_index but yield the arguments in # reverse order. Thus an array can be assume in certain cases to a hash. def each_pair(&block) each_with_index { |x, i| block[i, x] } end end # class Array
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
ttk-0.1.576 | ruby_ex/array_each_pair.rb |
ttk-0.1.579 | ruby_ex/array_each_pair.rb |
ttk-0.1.580 | ruby_ex/array_each_pair.rb |
vcs-0.2.148 | ruby_ex/array_each_pair.rb |