Daniel Schierbeck schrieb:

> When is this ever getting into Ruby Core?
> 
>   class Symbol
>     def to_proc
>       proc{|obj| obj.send(self) }
>     end
>   end
> 
> Consider this:
> 
>   class Numeric
>     def positive?
>       self > 0
>     end
>   end
> 
>   [1, 2, 3].all? &:positive?  => true
>   [-1, 2, 3].all? &:positive? => false
> 
> It's just so damn beautiful!

If you use this definition instead:

class Symbol
   def to_proc()
     lambda { |obj, *args| obj.send(self, *args) }
   end
end

You can also do this:

(1 .. 5).inject(&:+) # => 15
(1 .. 5).inject(&:*) # => 120

-- 
http://flgr.0x42.net/