Convert Ruby object to array
Have you ever been in a situation where you needed a method that does the following:
- Converts nil to an empty array
- Converts non-array variable n to [n]
- Leaves array variable as is
It can be accomplished using this method.
Post a comment