From: Robert Klemme Date: 2008-08-20T02:31:35+09:00 Subject: Re: Find element in array of hashes On 19.08.2008 18:47, Adgar Marks wrote: > Thanks for the fast answer, > > Robert Klemme wrote: >> On 19.08.2008 18:13, Adgar Marks wrote: >>> _FilesData << { :FileName => splitLine[8] , >>> :Year => year , >>> :Month => month , >>> :Day => day , >>> :Suffix => suffix , >>> :JDay => jday , >>> :Size => splitLine[4].to_i } >> I assume _DownloadData and _FilesData are of type Array. >> >>> I would like to know if FileName from _FileesData is in _DownloadData >>> and later or if the two files have the same size. >>> >>> I tried to write it like this: >>> if _DownloadData[:FileName].include?( _FilesData[:FileName] ) >>> >>> and i already got an error. >> Well, if they are arrays you rather need something like this: >> >> _DownloadData.each |dl| >> x = _FilesData.find {|fl| fl[:FileName] == dl[:FileName]} >> if x >> # found >> end >> end > > this x, is simply "true" or "fales", it is not exactly the solution i am > searching for. I would like to find a file name from one array of hashes > in the array hashes and then to compair the file size of both identical > filenames... This shows that you did not try it out or read the docs. Sorry to say that. robert