aboutsummaryrefslogblamecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/kernel.rb
blob: a2cb827d771e48960a62400ab76a400088be2476 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                                             
                      



         
module Kernel
  # A Ruby-ized realization of the K combinator, courtesy of Mikael Brockman.
  #
  #   def foo
  #     returning values = [] do
  #       values << 'bar'
  #       values << 'baz'
  #     end
  #   end
  #
  #   foo # => ['bar', 'baz']
  #
  def returning(value)
    yield
    value
  end
end