[MacRuby-devel] [MacRuby] #146: Crash While Using CSV
MacRuby
ruby-noreply at macosforge.org
Fri Oct 24 11:01:16 PDT 2008
#146: Crash While Using CSV
--------------------------------+-------------------------------------------
Reporter: ted.reed at gmail.com | Owner: lsansonetti at apple.com
Type: defect | Status: new
Priority: major | Milestone:
Component: MacRuby | Keywords:
--------------------------------+-------------------------------------------
I've encountered a crash in MacRuby. The following code works fine on
Leopard's standard Ruby, but causes MacRuby to die:
{{{
require 'csv'
filename = "/Users/treed/Documents/test.fr"
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
}}}
It seems like it's the call to ''reader.each'' that's crashing.
''reader.shift'' works fine, but even a blank loop with ''reader.each''
seems to crash.
If more info is needed, let me know and I can try to provide.
(Yeah, I was trying to implement the suggestions at the end of the ADC
tutorial. BTW, nice work so far, guys. I'm really impressed with MacRuby.)
--
Ticket URL: <http://www.macruby.org/trac/ticket/146>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list