Created
          July 28, 2013 14:46 
        
      - 
      
 - 
        
Save kachick/6098841 to your computer and use it in GitHub Desktop.  
    yieldへ2つ渡しててもブロック無しで呼んだらただのArrayにしかならないから、真偽使ってるなら気をつけたほうがいいかもね的なアレ
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # https://github.com/rubinius/rubinius/blob/7866fbd80db7fe6e1de2627f5442c8abe6ce51ad/kernel/common/enumerable.rb#L113 | |
| # https://github.com/rubinius/rubinius/blob/7866fbd80db7fe6e1de2627f5442c8abe6ce51ad/kernel/common/enumerable.rb#L428 | |
| class Foo | |
| def each | |
| yield false | |
| yield nil | |
| end | |
| end | |
| p Foo.new.to_enum.any? #=> false | |
| class Bar | |
| def each | |
| yield false | |
| yield nil, false | |
| end | |
| end | |
| p Bar.new.to_enum.any? #=> true | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment