From: unbewusst.sein@... (=?ISO-8859-1?Q?Une_B=E9vue?=) Date: 2010-06-02T23:25:05+09:00 Subject: Re: having a class method called only one time ? Une B�vue wrote: > Array HOST_IP = [] # the array let me make the constant "mutable" it seems to work like that : class HFSFile HOST_IP = [] ... def host_ip return HOST_IP.first unless HOST_IP.empty? HOST_IP << host_ip_get return @h[:host_ip] end ... private def host_ip_get $stderr.puts "'host_ip_get' was called!" # called 1 time for 2 instantiations. @h[:host_ip] = '' while @h[:host_ip].empty? @h[:host_ip] = `curl -s http://whatismyip.org`.chomp end return @h[:host_ip] end ... end -- � Les faiblesses des hommes font la force des femmes. � (Voltaire)