This project is archived and is in readonly mode.
ActiveSupport breaks literal "%%" in non-hash String interpolation
Reported by Henrik Nyh | February 25th, 2010 @ 11:09 AM
This works in regular Ruby 1.8 IRB:
>> "%d%%" % 123
=> "123%"
But with ActiveSupport:
>> "%d%%" % 123
ArgumentError: one hash required
It seems ActiveSupport attempts to emulate Ruby 1.9 string interpolation, but in doing so, it effectively breaks "%%" when you're not interpolating with a hash.
Will write patch shortly.
Comments and changes to this ticket
-
Henrik Nyh February 25th, 2010 @ 11:10 AM
- no changes were found...
-
Henrik Nyh February 25th, 2010 @ 11:47 AM
- Tag changed from string interpolation, activesupport, active_support, interpolation, ruby1.9 to string interpolation, activesupport, active_support, interpolation, patch, ruby1.9
When I run the tests, it seems the i18n gem is used for the actual interpolation. Apparently this issue has been fixed in the i18n gem on GitHub (http://github.com/svenfuchs/i18n/commit/bd740600683ca2aae78e4abf898.... That version of the gem does not appear to be published.
It's still not fixed in ActiveSupport proper, and since the i18n gem is used for interpolation in the ActiveSupport tests, at least the way I ran them, I'm not sure what the best course of action is. Should this functionality exist in both places? Should the tests be modified to actually test the ActiveSupport version? Did I run the tests wrong?
Either way, I made a patch, then ran the tests with that part of the i18n gem commented out, so that when this code actually runs, it does work.
-
Henrik Nyh February 25th, 2010 @ 12:28 PM
Monkeypatch initializer until this is applied: http://gist.github.com/314504
-
Ryan Bigg October 11th, 2010 @ 01:03 AM
- State changed from new to resolved
- Importance changed from to Low
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 3267 Problem with String Interpolation breaks WWW::Mechanize Guessing it's this issue: #4052
- 3267 Problem with String Interpolation breaks WWW::Mechanize According to #4052, this has been fixed. Please mention o...