Add `then` alias to `yield_self`.

`then' was added in CRuby 2.6.
parent a7c8575f
module Kernel module Kernel
# call-seq: # call-seq:
# obj.yield_self {|_obj|...} -> an_object # obj.yield_self {|_obj|...} -> an_object
# obj.then {|_obj|...} -> an_object
# #
# Yields <i>obj</i> and returns the result. # Yields <i>obj</i> and returns the result.
# #
...@@ -10,4 +11,5 @@ module Kernel ...@@ -10,4 +11,5 @@ module Kernel
return to_enum :yield_self unless block return to_enum :yield_self unless block
block.call(self) block.call(self)
end end
alias then yield_self
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment