Skip to content
Permalink
Browse files

passing specs for enumerable

  • Loading branch information
Alex Gaynor
Alex Gaynor committed Apr 7, 2013
1 parent 9681907 commit 634af2e6baa4e05322dbf85def887b0cfe75cbf5
@@ -44,7 +44,8 @@ def inject(*args)

alias reduce inject

def each_with_index
def each_with_index(&block)
return self.enum_for(:each_with_index) if !block
i = 0
self.each do |obj|
yield obj, i
@@ -88,13 +89,15 @@ def include?(obj)
alias member? include?

def drop(n)
n = Topaz.convert_type(n, Fixnum, :to_int)
raise ArgumentError.new("attempt to drop negative size") if n < 0
result = self.to_a
return [] if n > result.size
result[n...result.size]
end

def drop_while(&block)
return self.enum_for(:drop_while) if !block
result = []
dropping = true
self.each do |o|

This file was deleted.

@@ -1,2 +1 @@
fails:Enumerable#drop_while returns an Enumerator if no block given
fails:Enumerable#drop_while gathers whole arrays as elements when each yields multiple

0 comments on commit 634af2e

Please sign in to comment.
You can’t perform that action at this time.