Skip to content
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

symbolize clashes with ActiveSupport symbolize #122

Open
weedySeaDragon opened this issue Jan 20, 2017 · 1 comment
Open

symbolize clashes with ActiveSupport symbolize #122

weedySeaDragon opened this issue Jan 20, 2017 · 1 comment

Comments

@weedySeaDragon
Copy link

The symbolize_keys method in lib/core_ext.rb is also defined with exactly the same name in the ActiveSupport gem in lib/active_support/core_ext/hash/keys.rb

Both add the method to Hash

If both gems are used, this can result in warnings like this:

....rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/core_ext/hash/keys.rb:54: 
warning: method redefined; discarding old symbolize_keys
....rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/ruby-graphviz-1.2.2/lib/graphviz/core_ext.rb:28: 
warning: previous definition of symbolize_keys was here

To avoid collisions, this method should only be defined if it doesn't already exist in Hash,
or consider naming it something else. (preferably with a namespace or at least starting with graphviz_ so it's unlikely to collide with any other gems.

@technicalpickles
Copy link

I came across this for a different angle. I've been running memory_profiler on a slow spec, and ruby-graphviz came up as one of the top gems allocating memory, and it came down to the symbolize_keys implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants