Posted by Aaron Patterson (Guest)

>OH! I have an *awesome* solution:

>  %w(froot loops).instance_eval {
>    each { |e|
>      puts "self: %#{self.inspect}, e: #{e}"
>    }
>  }


Sebastian Hungerecker wrote:
> module Enumerable
>    def with_self
>      return enum_for(:with_self) unless block_given?
>      each {|e| yield e, self}
>    end
> end

Thanks for the great solutions.
-- 
Posted via http://www.ruby-forum.com/.