Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,648 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,123 people online right now. Registration is fast and FREE... Join Now!




Find compair two arrays of hashes

 
Reply to this topicStart new topic

Find compair two arrays of hashes

Adler
post 19 Aug, 2008 - 11:43 AM
Post #1


New D.I.C Head

*
Joined: 19 Aug, 2008
Posts: 1

Hi all,

I am a ruby beginer programer. I work a small ruby script and now i would like to add to it few more features and i dont really know how to apply it in a simply ruby language.

I have defined:

CODE

downloadData  = Array.new
filesData          = Array.new

downloadData << { :FileName =>  somthing         ,
                              :Size       =>  something.to_i  }
filesData << { :FileName =>  splitLine[8]      ,
                      :Year       =>  year              ,
                      :Month     =>  month             ,
                      :Day        =>  day               ,
                      :Suffix      =>  suffix            ,
                      :JDay       =>  jday              ,
                      :Size        =>  splitLine[4].to_i  }


i would like to know how to compair the two array of hashes, first by name and for the matching name to check if the size is also equel.

Thanks
User is offlineProfile CardPM

Go to the top of the page

Wgaffa
post 28 Aug, 2008 - 01:15 AM
Post #2


New D.I.C Head

*
Joined: 15 Apr, 2008
Posts: 4


My Contributions


If you look into the Array.find method you should be able to get the matching items
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 04:58AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month