Ruby: possible Poker holds for a hand of length n
Here's a demonstration of how you might solve this problem the Ruby way:
SUITS = %w[ H D C S ]
FACES = %w[ 2 3 4 5 6 7 8 9 T J Q K A ]

CARDS = SUITS.flat_map { |s| FACES.map { |f| &quot;#{f}#{s}&quot; } }

def holds(hand)
  hand.length.times.flat_map do |n|
    hand.combination(n).to_a
  end &lt;&lt; hand
end

holds(CARDS.shuffle.take(5))

Where you get results like this:
[[],
 [&quot;AD&quot;],
 [&quot;5H&quot;],
 [&quot;QS&quot;],
 [&quot;4H&quot;],
 [&quot;5D&quot;],
 [&quot;AD&quot;, &quot;5H&quot;],
 [&quot;AD&quot;, &quot;QS&quot;],
 [&quot;AD&quot;, &quot;4H&quot;],
 [&quot;AD&quot;, &quot;5D&quot;],
 [&quot;5H&quot;, &quot;QS&quot;],
 [&quot;5H&quot;, &quot;4H&quot;],
 [&quot;5H&quot;, &quot;5D&quot;],
 [&quot;QS&quot;, &quot;4H&quot;],
 [&quot;QS&quot;, &quot;5D&quot;],
 [&quot;4H&quot;, &quot;5D&quot;],
 [&quot;AD&quot;, &quot;5H&quot;, &quot;QS&quot;],
 [&quot;AD&quot;, &quot;5H&quot;, &quot;4H&quot;],
 [&quot;AD&quot;, &quot;5H&quot;, &quot;5D&quot;],
 [&quot;AD&quot;, &quot;QS&quot;, &quot;4H&quot;],
 [&quot;AD&quot;, &quot;QS&quot;, &quot;5D&quot;],
 [&quot;AD&quot;, &quot;4H&quot;, &quot;5D&quot;],
 [&quot;5H&quot;, &quot;QS&quot;, &quot;4H&quot;],
 [&quot;5H&quot;, &quot;QS&quot;, &quot;5D&quot;],
 [&quot;5H&quot;, &quot;4H&quot;, &quot;5D&quot;],
 [&quot;QS&quot;, &quot;4H&quot;, &quot;5D&quot;],
 [&quot;AD&quot;, &quot;5H&quot;, &quot;QS&quot;, &quot;4H&quot;],
 [&quot;AD&quot;, &quot;5H&quot;, &quot;QS&quot;, &quot;5D&quot;],
 [&quot;AD&quot;, &quot;5H&quot;, &quot;4H&quot;, &quot;5D&quot;],
 [&quot;AD&quot;, &quot;QS&quot;, &quot;4H&quot;, &quot;5D&quot;],
 [&quot;5H&quot;, &quot;QS&quot;, &quot;4H&quot;, &quot;5D&quot;],
 [&quot;AD&quot;, &quot;5H&quot;, &quot;QS&quot;, &quot;4H&quot;, &quot;5D&quot;]]

Personally I'd hold the pair of 5s and the Ace.
For educational purposes here's a more Ruby-esque form of your original code:
def possible_holds(hand_size)
  (2 ** hand_size).times.map do |n|
    n.to_s(2).rjust(hand_size, '0').chars.map { |c| c == '1' }
  end
end

It's kind of messy due to the binary string to boolean conversion.

Tip: Try to avoid &quot;casting a boolean to a boolean&quot; as in patterns like x ? true : false or if x; true; else; false like you had in your code. That reduces down to just x. The x == '1' test already returns a true or false value. There is no maybe or kind_of response.