Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/cricinfo.rb

Overview

Instance Method Summary collapse

Instance Method Details

#permutationsObject



17
18
19
20
21
22
# File 'lib/cricinfo.rb', line 17

def permutations
  return [self] if size < 2
  perm = []
  each { |e| (self - [e]).permutations.each { |p| perm << ([e] + p) } }
  perm
end