From: Stuart Clarke Date: 2009-07-29T23:20:03+09:00 Subject: Method question Hi all, Struggling a little with the concept of an exercise I am doing. I have two Ruby methods, the first does a simple string replace the second converts data to something else if the criteria is satisfied. See example below def processer field1 = data[0] field2 = data[1] field3 = data[2] if field3.length < 100 field3 = field3 else changer(field3) end field4 = data[3] field5 = data[4] if field5.length < 100 field5 = field5 else changer(field5) end end def changer(fieldData) splitData = fieldData.split(",") splitData.each do |output| p output end What I would like to happen is when field3 for example is longer than 100 and its data is passed to def charger, I want that method (def charger) to split the field on all commas and then return data to field3. I could just put something like field3 = output, however when I get other fields for example field5 this will not work and therefore I need something generic that will give the data to the correct field. I hope this makes sense. Any help is much appreciated Regards Stuart -- Posted via http://www.ruby-forum.com/.