Sha256: b9d8077d452ab9baf022e1f433a1205ffe4e55cba762c0a751886f6a762cbcd1

Contents?: true

Size: 242 Bytes

Versions: 10

Compression:

Stored size: 242 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

10 entries across 10 versions & 1 rubygems

Version Path
facets-2.8.4 lib/core/facets/kernel/complete.rb
facets-2.8.3 lib/core/facets/kernel/complete.rb
facets-2.8.2 lib/core/facets/kernel/complete.rb
facets-2.8.1 lib/core/facets/kernel/complete.rb
facets-2.8.0 lib/core/facets/kernel/complete.rb
facets-2.7.0 lib/core/facets/kernel/complete.rb
facets-2.6.0 lib/core/facets/kernel/complete.rb
facets-2.5.1 lib/core/facets/kernel/complete.rb
facets-2.5.0 lib/core/facets/kernel/complete.rb
facets-2.5.2 lib/core/facets/kernel/complete.rb