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

Join 136,812 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,212 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
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
+Quote Post

Wgaffa
RE: Find Compair Two Arrays Of Hashes
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
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 02:37PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month