SHARE
TWEET

damned ruby blocks

a guest Jul 3rd, 2012 1,541 Never
  1. def a(&block)
  2.   ('a'..'zzzz').each do |n|
  3.     begin
  4.       block.binding.eval("#{n} = '#{n}!'")
  5.     rescue Exception
  6.     end
  7.   end
  8. end
  9.  
  10. def z
  11.   asdf = 1
  12.   a{ asde = 2 }
  13.   asdf
  14. end
  15.  
  16. puts z
RAW Paste Data
Top