Method: Kernel#returning

Defined in:
lib/nano/kernel/returning.rb

#returning(value) ⇒ Object

A Ruby-ized realization of the K combinator.

def foo
  returning values = [] do
    values << 'bar'
    values << 'baz'
  end
end

foo # => ['bar', 'baz']


17
18
19
20
# File 'lib/nano/kernel/returning.rb', line 17

def returning(value)
  yield
  value
end