# 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