How do I check if a variable is Enumerable in Ruby?
Sometimes, you’ll have a scenario where you’ll want to check and see if something can be enumerated or not. To do this, create a method like this:
To see how this works, lets pass in 2 objects - a string and a array.
And there you have a simple and easy way to check if something can be enumerated on!