Apply PIE to nghttpx
[platform/upstream/nghttp2.git] / third-party / mruby / mrbgems / mruby-object-ext / mrblib / object.rb
1 class Object
2   ##
3   #  call-seq:
4   #     obj.tap{|x|...}    -> obj
5   #
6   #  Yields <code>x</code> to the block, and then returns <code>x</code>.
7   #  The primary purpose of this method is to "tap into" a method chain,
8   #  in order to perform operations on intermediate results within the chain.
9   #
10   #  (1..10)                .tap {|x| puts "original: #{x.inspect}"}
11   #    .to_a                .tap {|x| puts "array: #{x.inspect}"}
12   #    .select {|x| x%2==0} .tap {|x| puts "evens: #{x.inspect}"}
13   #    .map { |x| x*x }     .tap {|x| puts "squares: #{x.inspect}"}
14   #
15   def tap
16     yield self
17     self
18   end
19 end