From: "Sébastien Durand" Date: 2013-04-21T14:56:50+09:00 Subject: Tap method : good or bad practice ? Hi all ! I try to code a function that generates and returns options. Is it better to do this : def options options = {} 1.upto(31) { |i| options[i] = i } options end Or this : def options {}.tap { |options| 1.upto(31) { |i| options[i] = i } } end What is the Ruby way of doing this ? Is it common to use this trap method ? Thank you very much for your help (I'm new to Ruby) ! -- Posted via http://www.ruby-forum.com/.