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.

Convert Object#returning to Object#tap

#119

ActiveSupport is very noisy about the fact that Object#returning is deprecated. The deprecation messages seem to appear starting in version ActiveSupport 2.3.9 and #returning is gone as of 3.0.0.

From what I can tell Object#tap is in Ruby 1.8.7, but not in Ruby 1.8.6.

Before committing this support, please note any objections to this proposal in this ticket.

Reported by Ben Klang · October 8th, 2010 @ 09:04 AM

State: resolved
Milestone: 1.0.0
Assigned to: Ben Klang Ben Klang

Activity

  1. botp
    botp

    Yes, pls use tap.

    for ruby 1.8.6, you can simply do

    class Object

    def tap
      yield self
      self
    end
    

    end

    best regards -botp

    October 8th, 2010 @ 10:45 AM

  2. Ludovic Gasc
    Ludovic Gasc

    We use Adhearsion with Debian Lenny and Squeeze.
    This distribution provides Ruby 1.8.7.72 at least: http://packages.debian.org/lenny/ruby1.8

    From my point of view, you can change this dependency.

    Yours.

    October 9th, 2010 @ 11:14 AM

  3. Ben Klang
    Ben Klang
    • State changed from new to fixcommitted

    botp: Thanks for the reminder; your suggestion makes sense.

    I have committed a fix which monkeypatches Object to provide #tap if it does not exist.

    http://github.com/adhearsion/adhearsion/commit/9231b2346306722b6bed...

    This commit looks pretty safe but testing would be appreciated. I have tested it with Ruby 1.8.6 and 1.8.7.

    October 9th, 2010 @ 02:03 PM

  4. Ben Klang
    Ben Klang
    • Tag set to activesupport, dependencies

    October 21st, 2010 @ 06:57 PM

  5. Ben Klang
    Ben Klang
    • State changed from fixcommitted to resolved

    October 28th, 2010 @ 10:43 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.