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
- 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.
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>