Module: Metricstore::AllCombinations
- Included in:
- Array
- Defined in:
- lib/metricstore/monkey_patches.rb
Instance Method Summary collapse
Instance Method Details
#all_combinations ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/metricstore/monkey_patches.rb', line 3 def all_combinations if block_given? a = self.to_a 0.upto(size) do |n| a.combination(n) do |c| yield c end end else Enumerator.new do |yielder| a = self.to_a 0.upto(size) do |n| a.combination(n) do |c| yielder << c end end end end end |