Рубиновый метод Tap

# before
def my_method
  o = User.new
  o.a = 1
  o.b = 2
  o.c = 3
  o
end

# after
def my_method
  User.new.tap do |o|
    o.a = 1
    o.b = 2
    o.c = 3
  end
end

# The tap method yields the calling object to the block and returns it.
patrick204nqh