Pocket Gems interview question

Implement indexOf function given a haystack and needle string