aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/kernel.rb
blob: fe6f725bc09a3d53f8ad3dccbb0992f0ffe4a8ef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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) #:nodoc:
    yield
    value
  end
end