Question: I'm fairly new to ruby and I've got a hash that looks like so:

```
{ ["key1", "key2"] => 5, ["key1", "key3"] => 2, ... }

```

and I would like to convert it to an array that looks something like

```
[ ["key1", "key2", 5], ["key1", "key3", 2] ... ]

```

How would I go about doing this?

Answer: 
Simply:

```
hash.collect{|k, v| k << v}

```

Of if you need the original hash unchanged:

```
hash.collect{|k, v| k + [v]}

```
Another way could be:

```
hash.map(&:flatten)
# => [["key1", "key2", 5], ["key1", "key3", 2]]

```