**Solution 1**

```
def subsets(nums)
(0..nums.size).flat_map{ |k| nums.combination(k).to_a }
end
```

**Solution 2**

```
def subsets(nums)
subsets = [[]]
nums.each { |n| subsets += subsets.map { |s| s + [n] } }
subsets
end
```

**Solution 3**

```
def subsets(nums)
nums.reduce([[]]) { |subsets, n| subsets + subsets.map { |s| s + [n] } }
end
```