Created
December 17, 2011 07:48
-
-
Save pabloh/1489603 to your computer and use it in GitHub Desktop.
Revisions
-
pabloh renamed this gist
Dec 17, 2011 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
pabloh created this gist
Dec 17, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ # Instant result methods w/block (and different arities) [ [ %w[partition group_by sort_by min_by max_by minmax_by any? one? all? none?], ""], [ %w[each_slice each_cons each_with_object], "arg" ], [ %w[each_with_index reverse_each each_entry find detect find_index], "*args"] ].each do |methods, arguments| methods.each do |method| class_eval <<-METHOD_DEF def #{method} #{arguments} block_given? ? super : to_lazy_enum(:#{method}) end METHOD_DEF end end