From: Steve Tucknott Date: 2012-11-23T02:06:39+09:00 Subject: Re: Arrays with records as objects Robert, Thanks for the informative replies - very much appreciated. I am 'playing'/'learning' at the moment - so what I have been doing is taking base examples and then adding how I could use them in the 'real world'. In an earlier array example, I had used the record Openstruct structure as: # -- This is my test to see how arrays can be indexed.....a five element array # -- for names and address/post code addr = [] for i in 0..5 addr_rec = OpenStruct.new addr_rec.name = "Cust#{i+1}" addr_rec.line1 = "C#{i+1}Line1" addr_rec.line2 = "C#{i+1}Line2" addr_rec.line3 = "C#{i+1}Line3" addr_rec.line4 = "C#{i+1}Line4" addr_rec.pcode = "C#{i+1}PCode" addr[i] = addr_rec end for i in 0..(addr.length-1) `zenity --info --title="My Array" --text="Each Array Element:\n#{addr[i].name}\n#{addr[i].line1}\n#{addr[i].line2}\n#{addr[i].line3}\n#{addr[i].line4}\n#{addr[i].pcode}"` end So, because that seemed to work ok, I then wanted to try to represent the TodoList file line contents as a 'record' (in general, that is how I'm used to handling file data). Hence then getting the 'line' record into the array. In between postings though, I did remove the record structure, and made the item three separate instance variables again. So I think I'll create two versions of this - the single variables and record structure options. All the STDOUTs are my debug lines (as well as the main zenity system calls) to see what is going on. The 'toggle' on the status is driven by a zenity window - a checkbox just marks 'Done' - but I see what you mean. Thanks for the info on the ternary operator - and I'll look into logger calls and create an example for that! Is there a separate forum that you know of for complete Ruby newbies like me? Thanks again for your help. -- Posted via http://www.ruby-forum.com/.