-
-
Save cheald/c3f0e6ad394b1b437c21 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
$ JRUBY_OPTS="--2.0" irb | |
jruby-1.7.18 :001 > def foo(a, b, **options) | |
jruby-1.7.18 :002?> puts [a, b, options].inspect | |
jruby-1.7.18 :003?> end | |
=> nil | |
jruby-1.7.18 :004 > foo(1, 2) | |
[1, 2, {}] | |
=> nil | |
jruby-1.7.18 :005 > foo(1, 2, 3) | |
ArgumentError: wrong number of arguments (3 for 2) | |
from (irb):5:in `evaluate' | |
from org/jruby/RubyKernel.java:1107:in `eval' | |
from org/jruby/RubyKernel.java:1507:in `loop' | |
from org/jruby/RubyKernel.java:1270:in `catch' | |
from org/jruby/RubyKernel.java:1270:in `catch' | |
from /usr/local/rvm/rubies/jruby-1.7.18/bin/irb:13:in `(root)' | |
jruby-1.7.18 :006 > foo(1, 2, a: 1) | |
[1, 2, {}] | |
=> nil | |
jruby-1.7.18 :007 > foo(1, 2, a: 1, b: 2) | |
[1, 2, {}] | |
=> nil |
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
$ rvm 2.1.0 do irb | |
2.1.0 :001 > def foo(a, b, **options) | |
2.1.0 :002?> puts [a, b, options].inspect | |
2.1.0 :003?> end | |
=> :foo | |
2.1.0 :004 > foo(1, 2) | |
[1, 2, {}] | |
=> nil | |
2.1.0 :005 > foo(1, 2, 3) | |
ArgumentError: wrong number of arguments (3 for 2) | |
from (irb):1:in `foo' | |
from (irb):5 | |
from /usr/local/rvm/rubies/ruby-2.1.0/bin/irb:11:in `<main>' | |
2.1.0 :006 > foo(1, 2, a: 1) | |
[1, 2, {:a=>1}] | |
=> nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment