Daniel Schierbeck wrote:
> David A. Black wrote:
> 
>> I know that people.every could return
>> some kind of generator or enumerator, which could then be fed
>> "email_addr" symbolically... 
> 
> 
> 
> module Enumerable
>   def every
>     enum, obj = self, Object.new
>     obj.define_method :method_missing do |name, *args|
>       enum.map { |element| element.send(name, *args) }
>     end
>     return obj
>   end
> end
> 
> ary = ["john", "sylvia", "sarah"]
> ary.every.capitalize!
> 
> puts ary.join(", ") -> John, Sylvia, Sarah
> 
> 
> 
> Cheers,
> Daniel

By the way, you need the Object#define_method if you want it to work:

class Object
   def define_method(*args, &block)
     singleton_class = class << self; self; end
     singleton_class.module_eval do
       define_method(*args, &block)
     end
   end
end



Cheers,
Daniel