Guest User

Untitled

a guest
Feb 17th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. possibilities = %w(wed thur fri)
  2.  
  3. (1..possibilities.size).reduce([]) do |accumulator, count|
  4. accumulator + possibilities.combination(count).to_a
  5. end
  6.  
  7. # => [["wed"], ["thur"], ["fri"], ["wed", "thur"], ["wed", "fri"], ["thur", "fri"], ["wed", "thur", "fri"]]
Add Comment
Please, Sign In to add comment