In ruby you can ensure this by calling responds_to?(:method).
So for example to see if some object is iterable, you just check if it responds to each.
obj.responds_to?(:each)So for example to see if some object is iterable, you just check if it responds to each.
obj.responds_to?(:each)