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...
> 
> But note that this is inefficient if you have multiple entries in both
> arrays.  In that case building a hash with the file name as key could
> speed up things considerably.
> 
> Btw, conventionally variables in Ruby have all lowercase names with
> underscores and no leading underscore.
> 
> Kind regards
> 
>   robert

Thanks
-- 
Posted via http://www.ruby-forum.com/.