请帮我实现类Repeat
及其方法:
class Repeat
def initialize(n)
#TODO
end
def each
#TODO
end
end
def n_times(n)
#TODO
end
这段代码:
n_times(2) { |count| puts "You called me #{count} times" }
应该返回这个结果:
# You called me 1 times
# You called me 2 times