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
| class Array | |
| # | |
| # Iterates over each permutation of the enumerable values within the | |
| # {Array}. | |
| # | |
| # @yield [list] | |
| # The given block will be passed each permutation of the enumerable | |
| # values in the {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
| require 'stringio' | |
| require 'timeout' | |
| class Object | |
| def methods_returning(expected, *args, &blk) | |
| old_stdout = $> | |
| $> = StringIO.new | |
| methods.select do |meth| | |
| Timeout::timeout(1) { dup.public_send(meth, *args, &blk) == expected rescue false } rescue false |