from_to=iter(first:int, last:int) yields(int) n:int := first while n <= last yield(n) n := n + 1 end end from_to
Full article: http://jp.rubyist.net/magazine/?0009-Legwork