Sha256: 6195c49b54a54bbbc8a31eb0a9ea0497554f3d653b2f3b712f077ceca4bb387e

Contents?: true

Size: 272 Bytes

Versions: 10

Compression:

Stored size: 272 Bytes

Contents

module Enumerable

  if RUBY_VERSION < "1.9"

    # Return the first n items from the collection
    #
    def take(n)
      res = []
      count = 0
      each do |e|
        break if count >= n
        res << e
        count += 1
      end
      res
    end

  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

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