Created
June 29, 2011 07:07
-
-
Save brixen/1053308 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def m | |
yield :a | |
end | |
def n | |
yield :a, 1 | |
end | |
m { |x| p x } | |
n { |x| p x } | |
m { |*x| p x } | |
n { |*x| p x } | |
p [:a, :b].to_enum.to_a | |
p [:a, :b].each_with_index.to_a | |
[:a, :b].each_with_index { |x| p x } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sasha:rubinius2.0 brian$ ruby -v enum.rb | |
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] | |
:a | |
enum.rb:10: warning: multiple values for a block parameter (2 for 1) | |
from enum.rb:6 | |
[:a, 1] | |
[:a] | |
[:a, 1] | |
[:a, :b] | |
[[:a, 0], [:b, 1]] | |
enum.rb:17: warning: multiple values for a block parameter (2 for 1) | |
from enum.rb:10 | |
[:a, 0] | |
enum.rb:17: warning: multiple values for a block parameter (2 for 1) | |
from enum.rb:10 | |
[:b, 1] | |
sasha:rubinius2.0 brian$ rvm use 1.9.2 | |
Using /Users/brian/.rvm/gems/ruby-1.9.2-p180 | |
sasha:rubinius2.0 brian$ ruby -v enum.rb | |
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0] | |
:a | |
:a | |
[:a] | |
[:a, 1] | |
[:a, :b] | |
[[:a, 0], [:b, 1]] | |
:a | |
:b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment