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
fog-softlayer/lib/fog/softlayer/ext/hash.rb provides a monkeypatch on hash to add functionality to that class.
Adding a monkeypatch like that means that all users who include your gem end up having that method on the Hash object, which may interfere with their own overriding methods or interfere with similar things done in other libraries. This violates the principle of least surprise...
String is also monkeypatched, but in a less dangerous way. Because the additional methods have names that are very specific to this library, it is much less likely that they would interfere.
One possible way to fix this with minimal impact to the gem would be to use refinements which will only add the methods to the classes within the lexical scope where they are included (i.e. they wouldn't be used outside this gem unless somebody explicitly requests them)
The text was updated successfully, but these errors were encountered:
fog-softlayer/lib/fog/softlayer/ext/hash.rb provides a monkeypatch on hash to add functionality to that class.
Adding a monkeypatch like that means that all users who include your gem end up having that method on the Hash object, which may interfere with their own overriding methods or interfere with similar things done in other libraries. This violates the principle of least surprise...
String is also monkeypatched, but in a less dangerous way. Because the additional methods have names that are very specific to this library, it is much less likely that they would interfere.
One possible way to fix this with minimal impact to the gem would be to use refinements which will only add the methods to the classes within the lexical scope where they are included (i.e. they wouldn't be used outside this gem unless somebody explicitly requests them)
The text was updated successfully, but these errors were encountered: