irb: ArgumentError (wrong number of arguments (given 1, expected 0))
febeling opened this issue · 2 comments
febeling commented
Some expressions in irb result in an ArgumentError.
Consider this example:
$ irb
irb(main):001:0> x, y = "12in".scan(/^(\d+)(in|cm)$/)
Traceback (most recent call last):
4: from /Users/febeling/.rbenv/versions/2.7.2/bin/irb:23:in `<main>'
3: from /Users/febeling/.rbenv/versions/2.7.2/bin/irb:23:in `load'
2: from /Users/febeling/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/irb-1.2.7/exe/irb:11:in `<top (required)>'
1: from /Users/febeling/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/awesome_print-2.0.0.pre2/lib/awesome_print/custom_defaults.rb:22:in `output_value'
ArgumentError (wrong number of arguments (given 1, expected 0))
This is a distinct problem from #330, because it's in the context of using irb.
This commit ruby/irb@c5ea79d in IRB changed the signature of IRB::Irb#output_value to add one default argument.
When overriding same method in awesome_print https://github.com/awesome-print/awesome_print/blob/master/lib/awesome_print/custom_defaults.rb#L30 without this default parameter, the error is raised.
febeling commented
This is fixed in the fork AmazingPrint: https://github.com/amazing-print/amazing_print/pull/57/files
Maybe it's time to switch to this maintained alternative. The fix is exactly the same.
BryanH commented
PR will be merged once checks complete