New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ArgumentError: wrong number of arguments (given 1, expected 0) #330
Comments
+1 |
Works for me, if I disable the IRB Integration (https://github.com/awesome-print/awesome_print#irb-integration) |
The array_formatter was always returning an empty array when associated objects were called via a `has_many through:` relationship because they are loaded as a collection, and the collection is always considered empty. resolves: awesome-print#330
^ 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 similar comment
+1 |
This commit ruby/irb@c5ea79d 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. 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 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.The text was updated successfully, but these errors were encountered: