diff options
| author | Jun Hiroe <[email protected]> | 2014-03-16 19:11:37 +0900 |
|---|---|---|
| committer | Jun Hiroe <[email protected]> | 2014-03-17 01:18:44 +0900 |
| commit | a21088b2d7dffa1c13fa5eba35f230167f4b7d32 (patch) | |
| tree | e08de3caf028414ae2b3ad9895750465994139a0 | |
| parent | b9632bce46fc8cb6739cdaad403c8bf4b2a35b2a (diff) | |
| download | mruby-a21088b2d7dffa1c13fa5eba35f230167f4b7d32.tar.gz mruby-a21088b2d7dffa1c13fa5eba35f230167f4b7d32.zip | |
Refactor Enumerable#any?
| -rw-r--r-- | mrblib/enum.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/mrblib/enum.rb b/mrblib/enum.rb index 47e7399bf..6fa0c1ebb 100644 --- a/mrblib/enum.rb +++ b/mrblib/enum.rb @@ -48,23 +48,20 @@ module Enumerable # # 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 ## |
