Robert Klemme wrote in post #1106648:
>
> What is it that you want to achieve?  Can you please come up with a more
> realistic example?
>
> Kind regards
>
> robert

Hello Robert. I use this systematically, replacing for instance

def foo(args)
  hsh = Hash.new
  ## some lines building hsh by calling methods using args,
  hsh
end

by

def foo(args)
  Hash.new.tap do |hsh|
    ## same code as above
  end
end

I find the latter cleaner and easier to read, due to the extra 
indentation inside. I think Rails has a 'returning' method doing just 
that.

_md

-- 
Posted via http://www.ruby-forum.com/.