Sha256: 31d4f827587a2c8ef69c2a5a83a62dd3769d511268b2b8731717887543195888

Contents?: true

Size: 308 Bytes

Versions: 3

Compression:

Stored size: 308 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activesupport-1.0.4 lib/active_support/core_ext/kernel.rb
activesupport-1.1.0 lib/active_support/core_ext/kernel.rb
activesupport-1.1.1 lib/active_support/core_ext/kernel.rb