From: Kamarulnizam Rahim Date: 2011-02-05T11:34:28+09:00 Subject: dealing with nil output Hi, i use the following code to obtain data from my csv file and transfer it into a class: ef = EfficiencyE.new pp ef.blank = fields[1].tr_s('"', '').strip i put pp to see the output and the output says: "" "Efficiency (Energy)" "" "Turn-off unnecessary lights/equipment" C:/Users/Hekmatyer/Documents/NetBeansProjects/Nizam_BARU/lib/final.rb:574:in `block in
': undefined method `tr_s' for nil:NilClass (NoMethodError) from C:/Users/Hekmatyer/Documents/NetBeansProjects/Nizam_BARU/lib/final.rb:559:in `each_line' from C:/Users/Hekmatyer/Documents/NetBeansProjects/Nizam_BARU/lib/final.rb:559:in `
' I think i know the problem because there are empty content in my csv file. So how do i deal with this empty (nil) content? Nizam -- Posted via http://www.ruby-forum.com/.