thomas-mcdonald/serel — pull request #15 by invisiblefunnel (2013-03-13 07:53:26+00:00)
Title: Replace custom core extensions with ActiveSupport extensions

In Rails engines the [`isolate_namespace`](https://github.com/rails/rails/blob/v3.2.12/railties/lib/rails/engine.rb#L379-L408) method calls `singleton_class` and an error is thrown when Serel is also present. The override of Object#singleton_class in serel/exts.rb seems to be causing the problem. There is some related discussion at schneems/sextant#27. Here are steps to reproduce this issue using sextant as an example:

```console
$ ruby -v
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin11.4.2]
$ rails _3.2.12_ new test_app --skip-bundle --quiet && cd test_app
$ echo "gem 'serel', '1.1.1'" >> Gemfile
$ bundle --quiet
$ ruby -r./config/environment.rb -e "puts method(:singleton_class).source_location"
/Users/dwhalen/.rvm/gems/ruby-1.9.3-p392/gems/serel-1.1.1/lib/serel/exts.rb
17
$ echo "gem 'sextant', :group => :development" >> Gemfile
$ bundle --quiet
$ bundle exec rails s
/Users/dwhalen/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/engine.rb:388:in `isolate_namespace': private method `singleton_class' called for Sextant:Module (NoMethodError)
from /Users/dwhalen/.rvm/gems/ruby-1.9.3-p392/gems/sextant-0.2.3/lib/sextant/engine.rb:3:in `'
...
```

This pull request uses ActiveSupport to clean things up a bit and fix the current conflict with Rails::Engine.isolate_namespace. It includes the following changes:

* Add ActiveSupport dependency
* Remove serel/exts.rb
* Prefer String#classify and Module#const_get over custom method
* Use String#underscore instead of custom method

Thanks for taking a look!