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

Allow opting out of Adding to_uri to string #37

Closed
jacquescrocker opened this issue Sep 18, 2010 · 4 comments
Closed

Allow opting out of Adding to_uri to string #37

jacquescrocker opened this issue Sep 18, 2010 · 4 comments

Comments

@jacquescrocker
Copy link
Contributor

I'm generally very wary of APIs that add to string. Wrest looks really useful, but it seems adding to_uri doesnt seem like its really not needed. I see how it could be preferred by some people, but if you could allow a way to opt out of including core_ext/string that would be really nice.

Thanks

@kaiwren
Copy link
Contributor

kaiwren commented Sep 18, 2010

I've found that when doing a lot of work with uris the String helper is handy. I do understand your concern, so here's a fix I've added in 716f791 to make the to_uri helper method opt-out. If you're in a Rails app you'll have to do this before plugins/gems are loaded.

module Wrest
  NoStringExtensions = true
end
require 'lib/wrest'

Does this suit you?

@jacquescrocker
Copy link
Contributor Author

Cool, thanks for the patch. That seems ok. One possible improvement on this strategy would be to create a lib/wrest_no_ext.rb that includes these lines of code:

module Wrest
  NoStringExtensions = true
end
require 'wrest'

Then I can easily opt out via my Bundler Gemfile (or by requiring it wrest_no_ext specifically).

gem "wrest", :require => "wrest_no_ext"

Would be nice to be able to opt out of the Hash ext as well.

Thanks!

@kaiwren
Copy link
Contributor

kaiwren commented Sep 19, 2010

Beautiful solution. I'll do just that.

@kaiwren
Copy link
Contributor

kaiwren commented Sep 19, 2010

Fixed in 1bd935a and released in 1.0.0.beta5

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

No branches or pull requests

2 participants