rails/rails — pull request #10068 by kastiglione (2013-04-03 06:39:15+00:00)
Title: Replace string eval with alternatives

Similar to @tenderlove's ed9e3f699ab3fac01ad9ef038847d1cdd4c9f063, this pull request swaps out `class_eval` of strings for dynamic methods, and replaces it using either `define_method` or `delegate`.

I originally wrote this in January, for use in RubyMotion which doesn't support string eval. I didn't create a PR because at the time it seemed the preference was to use string eval when generating dynamic methods. If this is no longer the case, then perhaps there is interest in these changes.

This PR leaves `callbacks.rb` and `core_ext/module/delegation.rb` untouched. Rewriting their use of string eval would cause the code to be quite a bit less readable.

I ran the tests using ruby 2.0.0p0.