[DOC] Alias Kernel#yield_self to #then
This commit is contained in:
parent
d2ec0e8039
commit
5eb7cbf4e3
Notes:
git
2024-10-02 08:06:21 +00:00
16
kernel.rb
16
kernel.rb
@ -135,21 +135,7 @@ module Kernel
|
|||||||
yield(self)
|
yield(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
alias yield_self then
|
||||||
# call-seq:
|
|
||||||
# obj.yield_self {|x| block } -> an_object
|
|
||||||
#
|
|
||||||
# Yields self to the block and returns the result of the block.
|
|
||||||
#
|
|
||||||
# "my string".yield_self {|s| s.upcase } #=> "MY STRING"
|
|
||||||
#
|
|
||||||
def yield_self
|
|
||||||
Primitive.attr! :inline_block
|
|
||||||
unless defined?(yield)
|
|
||||||
return Primitive.cexpr! 'SIZED_ENUMERATOR(self, 0, 0, rb_obj_size)'
|
|
||||||
end
|
|
||||||
yield(self)
|
|
||||||
end
|
|
||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user