From: "Iñaki Baz Castillo" Date: 2009-03-30T18:38:27+09:00 Subject: Re: Symbols garbage collector in Ruby1.9, fixed? 2009/3/30 Bill Kelly : > > From: "Iñaki Baz Castillo" >> >> A way to check if a Symbol already exist would be enought for me, but >> it doesn't work: >> To know all the current Symbols I can inspect Symbol.all_symbols, but >> if I want to check a Symbol: >>  Symbol.all_symbols.include?(:new_symbol) >> this will always return true since :new_symbol is automatically added >>  XDDD > > potential_new_symbol = "xyzzy" > Symbol.all_symbols.map {|s| s.to_s}.include? potential_new_symbol Thanks but it is too slow: Benchmark.realtime{ Symbol.all_symbols.map {|s| s.to_s}.include? "qwe" } => 0.00371980667114258 I cannot do this test for each header in each received message. Thanks. > ? > > > Regards, > > Bil > > > > -- Iñaki Baz Castillo