#146: Crash While Using CSV --------------------------------+------------------------------------------- Reporter: ted.r...@… | Owner: lsansone...@… Type: defect | Status: closed Priority: major | Milestone: MacRuby 0.5 Component: MacRuby | Resolution: fixed Keywords: | --------------------------------+------------------------------------------- Changes (by lsansone...@…):
* status: new => closed * resolution: => fixed * milestone: => MacRuby 0.5 Comment: Looks like this is fixed in trunk. {{{ $ cat t.rb require 'csv' filename = "t.csv" friends = [] class Friend attr_accessor :first_name, :last_name, :phone_number, :email_address end reader = CSV.open(filename, 'r') reader.each do |row| # All of this inside the loop can be commented out and the outcome is the same. friend = Friend.new friend.first_name = (row[0] || "") friend.last_name = (row[1] || "") friend.phone_number = (row[2] || "") friend.email_address = (row[3] || "") friends << friend end reader.close p friends }}} {{{ $ ./miniruby t.rb [##-<Friend:0x20031abe0 @first_name="John", @last_name="Smith", @phone_number="", @email_address="">, ##-<Friend:0x20031e7e0 @first_name="John", @last_name="Smith", @phone_number="", @email_address="">, ##-<Friend:0x20031fd80 @first_name="John", @last_name="Smith", @phone_number="555-1212", @email_address="">, ##-<Friend:0x2003210c0 @first_name="John", @last_name="Thompson", @phone_number="", @email_address="">] $ ruby19 t.rb [#<Friend:0x00000100a68438 @first_name="John", @last_name="Smith", @phone_number="", @email_address="">, #<Friend:0x00000100a67e48 @first_name="John", @last_name="Smith", @phone_number="", @email_address="">, #<Friend:0x00000100a67808 @first_name="John", @last_name="Smith", @phone_number="555-1212", @email_address="">, #<Friend:0x00000100a67240 @first_name="John", @last_name="Thompson", @phone_number="", @email_address="">] }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/146#comment:2> MacRuby <http://macruby.org/> _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel