Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

refactor #try to use inheritance

#1774

I'm not a fan of Object#try, but if it's going to be in the code base, the implementation should at least be optimal. This patch collapses two method calls and a conditional test into a single method call by splitting the two cases into two methods in Object and NilClass.

Reported by Josh Susser · January 17th, 2009 @ 01:32 AM

State: resolved
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Xavier Noria
    Xavier Noria

    Hi Josh, just a few details about the rdoc:

    • Section headers have no colon normally. I've seen a few exceptions in the current tree whose remaining time of existence can be measured in minutes :-).

    • "With try" is not commented.

    • Code example lacks indentation.

    January 17th, 2009 @ 01:58 AM

  2. Josh Susser
    Josh Susser

    I mainly copied the rdoc from the old implementation but oh well. Fixed it up. Don't know enough about rdoc to fool it, so I added a doc-only method def that gets dropped by aliasing try to send. Better ideas of how to rdoc this are welcome.

    January 17th, 2009 @ 02:57 AM

  3. Xavier Noria
  4. Repository
    Repository
    • State changed from new to resolved

    (from [78f2c19ae7f9236591c261eecdf0c4b570e3ea1e]) Refactor Object#try to use inheritance. [#1774 refactor #try to use inheritance state:resolved]

    Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...

    January 18th, 2009 @ 12:48 AM