Imported Upstream version 1.41.0
[platform/upstream/nghttp2.git] / third-party / mruby / mrbgems / mruby-kernel-ext / mrblib / kernel.rb
1 module Kernel
2   # call-seq:
3   #   obj.yield_self {|_obj|...} -> an_object
4   #   obj.then {|_obj|...}       -> an_object
5   #
6   # Yields <i>obj</i> and returns the result.
7   #
8   #   'my string'.yield_self {|s|s.upcase} #=> "MY STRING"
9   #
10   def yield_self(&block)
11     return to_enum :yield_self unless block
12     block.call(self)
13   end
14   alias then yield_self
15 end