hoodwink.d enhanced
RSS
2.0
XHTML
1.0

RedHanded

Tuesday

2006.06.27

Counting At The Cloak 'N' Bind #

by why in inspect

So Method#to_proc is basically totally bankrupt. It is now the most severely mocked typecast in the book. From RailsConf:

 [10, 20, 30].map &4.method(:+)

 ary.each &(hsh={}).method(:store)

 def initialize(hsh)
   hsh.each &method(:instance_variable_set)
 end

Clearly, fun stuff. But, you know, bankrupt.

If you don’t mind drawing a bit more blood, did you know you can use this stuff to kill (\w+)_with_index?

 %w[joe tim francis].map &with_index { |x| [x, index] }
  #=> [["joe", 0], ["tim", 1], ["francis", 2]]

Continue to full post. (342 words)