Skip to content

Instantly share code, notes, and snippets.

@fudanchii
Created March 13, 2012 00:41
Show Gist options
  • Save fudanchii/2025778 to your computer and use it in GitHub Desktop.
Save fudanchii/2025778 to your computer and use it in GitHub Desktop.
def p(a)
print a
print "\n"
end
def a(ab, *test)
p test.inspect
end
a(1,:ss => "123", :ab => 123)
a(2,1)
a(3)
a(4,nil)
b = *[]
p b.inspect
b = *nil
p b.inspect
b = *{}
p b.inspect
b = *{:a=>123,:b=>321,:c=>nil}
p b.inspect
b = *[1,2,3]
p b.inspect
b=*""
p b.inspect
b=*1
p b.inspect
@fudanchii
Copy link
Author

output from ruby 1.8

[{:ss=>"123", :ab=>123}]
[1]
[]
[nil]
nil
nil
nil
[[:b, 321], [:c, nil], [:a, 123]]
[1, 2, 3]
nil
1

@fudanchii
Copy link
Author

from jruby 1.6.5 (ruby 1.8.7)

[{:ss=>"123", :ab=>123}]
[1]
[]
[nil]
nil
nil
nil
[[:a, 123], [:b, 321], [:c, nil]]
[1, 2, 3]
nil
1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment