David Kimura PRO said over 3 years ago on Gem in a Box :
  It's just a preference when creating an array or hash. In this particular case there wouldn't be any benefit over
array = []
array << { username: 'username', password: 'password' }

However, in many other situations doing a [].tap or {}.tap is pretty handy in conditionally adding items. For example,

User.new(user_params)

def user_params
  allowed_params = [].tap do |array|
    array << :first_name
    array << :last_name
    array << :admin if current_user.admin?
  end
  params.require(:user).permit(allowed_params)
end