This project is archived and is in readonly mode.
plugin.rb incompatibility with Ruby 1.9
-
Matt Jones
- Tag changed from patch to patch, ruby1.9
This patch still needs some work - note that String#lines is not defined for RUBY_VERSION < 1.9. Given the current speed of the migration effort, Ruby 1.8 support is needed. I'd recommend that you revise the patch in the spirit of line 904 of plugin.rb:
@urls_to_fetch = RUBY_VERSION >= '1.9' ? urls_to_fetch.lines : urls_to_fetch.to_a..which will work correctly on both 1.9 and 1.8.
Either that, or you could use an approach like this:
lines = str.send(str.respond_to?(:lines) ? :lines : :to_s).to_a(from this blog post )
-
Jeff Schwab
Thanks for the gentle treatment of my rookie mistake. An updated patch is attached.
In other codebases, I would include a comment, explaining what I did and why, and referring to this bug report. I see that there are no other such comments in the file, so I guess they only go in the version control logs. Here is a "starter" log entry:
Ruby 1.8 strings are Enumerable, but do not support :lines. In Ruby 1.9, the situation is reversed.
-
Pratik
- Assigned user set to Jeremy Kemper
-
Repository
- State changed from new to committed
(from [e609d83f1a7f49bf8a9549c480a67ee045950336]) Fixed an incompatibility with Ruby 1.9.
Ruby 1.8 strings are Enumerable, but there is no String#lines method. In Ruby 1.9, the situation is reversed. To work around this disparity, the RailsEnvironment#externals method now explicitly checks whether a String responds_to? :lines.
[#2130 plugin.rb incompatibility with Ruby 1.9 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net http://github.com/rails/rails/co...
