public
Created

  • Download Gist
blocks.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
igrigorik { /git/goliath/examples } > cat test.rb
blk = Proc.new {|a,*b| p [:block_args, a,b] }
 
blk.call(1,2,3)
blk.call([1,2,3])
igrigorik { /git/goliath/examples } > ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]
igrigorik { /git/goliath/examples } > ruby test.rb
[:block_args, 1, [2, 3]]
[:block_args, 1, [2, 3]]
igrigorik { /git/goliath/examples } > rvm use jruby
Using /Users/igrigorik/.rvm/gems/jruby-1.6.2
igrigorik { /git/goliath/examples } > jruby --1.9 test.rb
[:block_args, 1, [2, 3]]
[:block_args, [1, 2, 3], []] <<<<<<<<<<<<<<<<<<<<<<< Hmmm?
igrigorik { /git/goliath/examples } > jruby test.rb
[:block_args, 1, [2, 3]]
[:block_args, 1, [2, 3]]

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.