Add similar method to ruby .times