You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hashie-3.2.0/lib/hashie/dash.rb:41:in `block in property': wrong number of arguments (1 for 0) (ArgumentError)
from /Users/alext/.rvm/gems/ruby-2.1.2/gems/hashie-3.2.0/lib/hashie/hash.rb:48:in `flexibly_convert_to_hash'
from /Users/alext/.rvm/gems/ruby-2.1.2/gems/hashie-3.2.0/lib/hashie/hash.rb:34:in `block in to_hash'
from /Users/alext/.rvm/gems/ruby-2.1.2/gems/hashie-3.2.0/lib/hashie/hash.rb:20:in `each'
from /Users/alext/.rvm/gems/ruby-2.1.2/gems/hashie-3.2.0/lib/hashie/hash.rb:20:in `to_hash'
from /Users/alext/.rvm/gems/ruby-2.1.2/gems/hashie-3.2.0/lib/hashie/hash.rb:42:in `to_json'
from ./problem.sh:24:in `<main>'
Basically the problem is that the instance method: "method" is overridden in the Recipient class. And when called in the snippet bellow it produces the error.
I've been thinking about this since I saw the report. As with the related issue with Mash (see #119 and #198 for the discussion), it comes down to the issue of how much we can/want to prevent people from shooting themselves in the foot. If someone creates a property named method, what do they think is going to happen? Everyone should know that Object#method and that creating a property named method would conflict with that. It's just not something you should do.
That being said, we:
definitely should note in the README that dangerous things can be done with Dash.
could make an extension for Dash that prevents these dangerous actions, like I did for Mash.
As for default behavior, it would be nice if this wasn't an issue and that everyone could define whatever method they wanted. However, I'm not sure that's really feasible -- and the ways that I can think of to accomplish this would cause the same issue as with Mash in that a Dash should quack like a Hash. I think we should just note it in the README and leave it as is, or create a safe extension.
The result is:
Basically the problem is that the instance method: "method" is overridden in the Recipient class. And when called in the snippet bellow it produces the error.
Also I can see that the method
def self.property
indash.rb
contains the following code that handles a similar case:So I guess I opened this issue mostly as a discussion on how to handle this case?
The text was updated successfully, but these errors were encountered: