1 2 class Time 3 def set_interval(seconds) 4 @interval = seconds 5 end 6 def succ 7 @interval ||= 1 8 ret = self + @interval 9 ret.set_interval(@interval) 10 ret 11 end 12 end
You need to create an account or log in to post comments to this site.
12970 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
1 2 class Time 3 def set_interval(seconds) 4 @interval = seconds 5 end 6 def succ 7 @interval ||= 1 8 ret = self + @interval 9 ret.set_interval(@interval) 10 ret 11 end 12 end
You need to create an account or log in to post comments to this site.