This project is archived and is in readonly mode.
Ruby 1.9 style String interpolation support for lower ruby versions.
-
Sven Fuchs
- Assigned user set to Jeremy Kemper
+1 this would make our upgrade path to ruby 1.9 much smoother AND add a ton of flexibility to our interpolation api
Jeremy, wdyt? :)
-
Repository
- State changed from new to resolved
(from [da635394c1c3004f4dacf4a35275404e5b1aef43]) Ruby 1.9 style String interpolation support for lower ruby versions. Thanks to code from Masao Mutoh's GetText gem. [#2870 Ruby 1.9 style String interpolation support for lower ruby versions. state:resolved]
Signed-off-by: Yehuda Katz wycats@yehuda-katzs-macbookpro41.local
http://github.com/rails/rails/commit/da635394c1c3004f4dacf4a3527540... -
Sven Fuchs
- State changed from resolved to open
- Tag changed from 3.0, patch to 2-3-stable, 3.0, patch
- Assigned user changed from Jeremy Kemper to Yehuda Katz (wycats)
Thanks for applying, Yehuda :)
Couple of things:
I noticed the tests don't pass on Ruby 1.9 because Masao's code does not mirror Ruby 1.9's behaviour exactly, but the tests of course specify what the code does. This is true for two situations where Ruby 1.9 raises exceptions while Masao's extension doesn't:
- Ruby 1.9 raises a KeyError exception for missing named interpolation args (e.g. "%{foo}" % {:bar => :bar})
- Ruby 1.9 raises an ArgumentError when mixing named and unnamed placeholders (e.g. "%{foo} %f" % [1.0])
Also, we'll only want to include this code when we're on < Ruby 1.9.
I'll append a patch that fixes these things and also improves the docs and Rails conventions compliance a little bit.
After applying this, can you please also BACKPORT this to 2.3-stable? That'd be great :)
I'll reopen the ticket and assign to Yehuda.
-
Repository
- State changed from open to committed
(from [17d5cc12b9f8d0d78a081d231e7e0c5ec9df1104]) * don't include String#% for Ruby 1.9 * raise a KeyError exception for missing named interpolation args (like Ruby 1.9 does) * raise an ArgumentError when mixing named and unnamed placeholders (like Ruby 1.9 does) * improve docs and comply a bit more w/ Rails names/conventions
[#2870 Ruby 1.9 style String interpolation support for lower ruby versions. state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/17d5cc12b9f8d0d78a081d231e7e0c...
