detect: implement by Ruby