Sha256: fbf83fd0c79e5ba51e366e977cfc19a840919e7d031eede7d347d54254f9851e

Contents?: true

Size: 243 Bytes

Versions: 7

Compression:

Stored size: 243 Bytes

Contents

module Kernel

  # Repeat loop until it yeilds false or nil.
  #
  #   a = [3, 2, 1]
  #   complete do
  #     b << a.pop
  #   end
  #   b  #=> [3, 2, 1, nil]
  #
  #  CREDIT: Trans

  def complete
    loop { break unless yield }
  end

end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
facets-2.4.0 lib/facets/kernel/complete.rb
facets-2.4.1 lib/facets/kernel/complete.rb
facets-2.4.2 lib/core/facets/kernel/complete.rb
facets-2.4.3 lib/core/facets/kernel/complete.rb
facets-2.4.4 lib/core/facets/kernel/complete.rb
facets-2.4.5 lib/core/facets/kernel/complete.rb
mack-facets-0.8.2 lib/gems/facets-2.4.5/lib/core/facets/kernel/complete.rb