From: botp Date: 2009-04-09T01:39:03+09:00 Subject: Re: performing an action only the first time a function called On Wed, Apr 8, 2009 at 10:29 PM, James French wrote: > Obviously the intention is to only do something the first time it is called. Maybe some little reusable util? I have a number of different bootstrap functions I want to apply this to. > sometimes, i apply ruby's nested methods feature... eg, botp@jedi-hopeful:~$ cat test.rb def only_once_dumper def only_once end end def only_once puts "i ran once!" only_once_dumper end only_once only_once only_once botp@jedi-hopeful:~$ ruby test.rb i ran once! botp@jedi-hopeful:~$ kind regards -botp