I'm having an issue figuring out how to pass an IO stream to a method.

write_it = File.new("test_ids", "w")

def getid (line, file_info)
    find_id = line.split(" ")
    find_id.each do |get_id|
        if get_id =~ /^id*/
            return get_id
        else
            file_info.puts("No ID.")
            return "No ID"
        end
    end
end

a = "name=example id=stuff"
b = "name=example noid=writefile"

getid(a, write_it)
getid(b, write_it)

I've also tried with def getid(line) thinking maybe I didn't need to
pass an IO stream, but it still doesn't work.

-- 
Posted via http://www.ruby-forum.com/.