From: "Iñaki Baz Castillo" Date: 2009-03-30T18:17:40+09:00 Subject: Re: Symbols garbage collector in Ruby1.9, fixed? 2009/3/30 F. Senault : > > It depends on what exactly you are trying to do with your hash.  If you > need to access to a few well known headers in your code, use symbols for > those and add another pseudo-header for the rest of the info : > > USEFUL_HEADERS = [ :from, :to, :"x-mailer" ] > > headers = { >  :from => "alice@aaa.com", >  :to => "bob@bbb.com", >  :"x-mailer" => "Pegasus Mail for Windows (4.50 PB1)", >  :"_custom" => { >    "x-custom-header-1" => "Hi there", >    "x-spam-scanned" => "Of course" >  } > } > > (Now, you'll lose time at the parse step.  Again, depending on what > you're trying to do, it may be efficient if each mail is parsed one time > and, then, each header is accessed a lot of times.) Thanks, but I prefer to store all the headers in a transparent way so accessing to a core and well known header is the same as accesing to a custom and never seen header: headers[:from] header[:"x-custom-headers"] This is, in the transport/parsing layer I cannot know which headers will be important or not in the "application" layer. 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 Thanks. -- Iñaki Baz Castillo