**Solution 1**

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

**Solution 2**

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

**Solution 3**

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