Open Irostovsky opened 6 years ago
+1
Works for me, if I disable the IRB Integration (https://github.com/awesome-print/awesome_print#irb-integration)
^ is an accidental ref. I was experiencing a similar error however it is specifically with the array_formatter, not the hash_formatter... not entirely sure how to remove the ref. Sorry!
Hi! I'm having the same problem. Is there any workaround for this for an app with awesome_print installed through the Gemfile?
+1
+1
You are aware that commenting "+1" doesn't help, makes no difference, and it's spamming us with a useless message, right?
There is this neat little button, which you can press to add your "participation" to the issue
This commit https://github.com/ruby/irb/commit/c5ea79d5cecea9cae6ad0c1f31703a98cd329431 in IRB changes the signature of IRB::Irb#output_value to add one default argument.
When overriding same method in awesome_print without this default parameter, the error is raised.
I just realize this issue is not about the ArgumentError that I was experiencing. The one I encountered (and fixed in the PR) is avoided by disabling awesome_print support for IRB. This is probably the one @sunsations saw too, but that seems to be a separate issue. (It isn't, as his comment from a time before the IRB change.)
That issue would be fixed by my fix/PR (closed now).
Also, this issue is from 2018, and the change in irb which I thought was the cause dates from August 2020.
I think I'm at the bottom of this. net/http's Net::HTTPGenericRequest has an attribute with a reader method
; that conflicts with Ruby's core Object#method(sym)
.
Now awesome_print in the fallback_formatter converts objects to hashes for output. It relies on Object#method to check for that here: https://github.com/awesome-print/awesome_print/blob/awesomeprint2/lib/awesome_print/formatters/fallback_formatter.rb#L41 (for the version 2 branch, which is pre-released).
How to fix this? The real problem is the net/http class shadowing Object#method. I don't see an easy general fix. Possibly add another special formatter to awesome_print, as there are some already for other classes (24 files for various ruby core classes, I don't see any stdlib formatters for now)?
The reason that instance of the
Net::HTTP::Post POST
has the methodmethod
. And into https://github.com/awesome-print/awesome_print/blob/master/lib/awesome_print/formatter.rb#L114 tries to callmethod
with param.