lib/core/facets/enumerable/take.rb in facets-2.8.4 vs lib/core/facets/enumerable/take.rb in facets-2.9.0.pre.1

- old
+ new

@@ -1,20 +1,16 @@ 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 + # 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 - - end + res + end unless method_defined?(:take) end