Skip to content

Commit

Permalink
Refactor Enumerable#any?
Browse files Browse the repository at this point in the history
  • Loading branch information
suzukaze committed Mar 16, 2014
1 parent b9632bc commit a21088b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions mrblib/enum.rb
Expand Up @@ -48,23 +48,20 @@ def all?(&block)
#
# ISO 15.3.2.2.2
def any?(&block)
st = false
if block
self.each{|val|
if block.call(val)
st = true
break
return true
end
}
else
self.each{|val|
if val
st = true
break
return true
end
}
end
st
false
end

##
Expand Down

0 comments on commit a21088b

Please sign in to comment.