A method that applies self to a proc
问题 I want to have a method defined on Object that takes a block and applies the receiver to the block. An implementation will be like the following: class Object def apply ≺ pr.call(self) end end 2.apply{|x| x * 3} # => 6 Is there already a standard way to do this or a well known library that has a method with similar use? If so, I didn't want to reinvent the wheel. It happens to me very often that, I have a method that takes an optional block, and when there is no block, I want to return