この回答は、同様の質問に対するJamesKyburzの回答のコピーです。
ルビーにはこれはありません。一番近いのは自分です。
ここにあなたの途中であなたを助けるためのいくつかの例があります
#example 1 not self needed numbers is the array
numbers = [1, 2, 3]
numbers.reduce(:+).to_f / numbers.size
# example 2 using tap which gives access to self and returns self
# hence why total variable is needed
total = 0
[1, 2, 3].tap {|a| total = a.reduce(:+).to_f / a.size }
# instance_eval hack which accesses self, and the block after do is an expression
# can return the average without an extra variable
[1, 2, 3].instance_eval { self.reduce(:+).to_f / self.size } # => 2.0
これまでのところ、例1を好みます