From: "Iñaki Baz Castillo" Date: 2008-06-30T06:56:21+09:00 Subject: Re: How to doing a "grep -v" to hide "---" line added by Hash#to_yaml ? El Domingo, 29 de Junio de 2008, phlip escribió: > Shashank Agarwal wrote: > >> {1=>2,"ABC" => {"a"=>"A","b"=>"B"}}.to_yaml.sub("--- \n", '') > > > > Awesome. Totally forgot about negative indexes. > > I would use the .sub option because it is explicit about what it is > removing. > > However, the Hash did not add the --- . It is part of the YAML standard as > the start of a document. You should consider leaving it alone, because > other YAML tools will like it. Yes, that's true, that "---" is part of the YAML grammar, but the fact is that I'm only showing it, printing it, no more. Thanks. -- Iñaki Baz Castillo