From: Devin Mullins Date: 2006-12-10T02:45:35+09:00 Subject: Re: File.yaml?(fname) Trans wrote: > what's the best way to determine if a file is yaml? Naive answer: def File.yaml?(fname) YAML.load(IO.read(fname)) true rescue ArgumentError false end Though, open up irb -ryaml and keep running this line: YAML.load Array.new(60){rand 256}.pack('c*') I'm not sure that's what you're after. :) And I'm guessing you didn't mean: def File.yaml?(fname) extname(fname) =~ /^ya?ml$/ end Devin