From: Robert Klemme Date: 2013-02-11T19:39:28+09:00 Subject: Re: Ruby Equivalent to VB's "With"? On Mon, Feb 11, 2013 at 10:04 AM, Joel Pearson wrote: > Nice one Henry. As usual Ruby has more than one way to do everything :) IMHO #tap is only called for in these situations - The value to be tapped is the result of evaluating an expression (and not already stored in a variable) AND - It should be used as the result of the larger expression. Typical example: module Enumerable def group_by {}.tap do |groups| each do |e| (groups[yield(e)] ||= []) << e end end end end In all other cases doing a simple assignment like mo = my_object mo = my.complicated.expression is probably easier, cleaner and faster. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/