From: Carlos Delmar Date: 2006-01-06T01:00:20+09:00 Subject: how remove puts inside method? I have a method (process_transaction) that uses puts to output a result. Now I wanted to remove puts, so I could further process the result of the method before printing it. But I can't get it to work ... # method checks what key matches with string # and adds additional info to each string def process_transaction (line_of_file) if get_money(line_of_file) < 0 Ausgabekonten.any? { |key, konto| if key =~ line_of_file kontonummer = extract_four_digit(konto) puts line_of_file.chomp + " \"" + key.to_s + "\" " + kontonummer.to_s + " 1200" + " AUSGABE" break true end } or warn line_of_file.chomp + " (no key) \"\" \"\" \"\" AUSGABE_NO_KEY" else Einnahmekonten.any? { |key, konto| if key =~ line_of_file kontonummer = extract_four_digit(konto) puts line_of_file.chomp + " \"" + key.to_s + "\"" + " 1200 " + kontonummer.to_s + " EINNAHME" break true end } or warn line_of_file.chomp + " (no key) \"\" \"\" \"\" EINNAHME_NO_KEY" end end # apply process_transaction to each line of the transactions array transactions.each do |member| process_transaction(member) end -- Posted via http://www.ruby-forum.com/.