Given a block method which takes an argument and an optional hash, zeus cannot recognize the block on the commandline if paretheses are used.
To wit, on the commandline
2.1.0 > def test(sym, opts={}, &block)
2.1.0?> puts "starting #{sym} with options #{opts.to_s}"
2.1.0?> yield
2.1.0?> puts "ending #{sym}"
2.1.0?> end
:test
2.1.0 >
Note the question marks denoting "we are still in the block." Running this with a single argument:
2.1.0 > test :something do
2.1.0 > puts "inside"
2.1.0?> end
starting something with options {}
inside
ending something
nil
2.1.0 >
Running this with a hash argument works, too:
2.1.0 > test :sym, for: :something do
2.1.0 > puts "inside"
2.1.0?> end
starting sym with options {:for=>:something}
inside
ending sym
nil
But use paretheses around the arguments, and things break:
2.1.0 > test(:sym, for: :something) do
2.1.0 > puts "inside"
2.1.0?> end
2.1.0?> # <- We hit <enter>, but are still considered to be in the block, rather than evaluated!!
2.1.0 > end # <- Hitting enter again does nothing, can only escape by typing 'end' which throws an exception
SyntaxError: (irb):21: syntax error, unexpected keyword_end, expecting end-of-input
Same occurs with inline syntax
2.1.0 :029 > test(:sym){puts "inside"}
starting sym with options {}
inside
ending sym
nil
2.1.0 :030 > test(:sym, for: :something){puts "inside"}
2.1.0 :031?> # <- Still in the block
2.1.0 :032 > # <- Still in the block!
So, apparently, one cannot use paretheses to surround arguments when using Zeus on the console.