See if you can guess what this code will do before you run it in ruby.
upc = Proc.new {|m| $1.upcase} puts "hello world".gsub(/([aeiou])/, &upc) puts "hello world".gsub(/(\w)/, &upc) def doit(str, re, blk) puts str.gsub(re, &blk) end doit "hello world", /([aeiou])/, upc doit "hello world", /(\w)/, upc
Now try running it in JRuby. Whoa.
random
recent