[MacRuby-devel] [MacRuby] #125: Problem with CSV library
MacRuby
ruby-noreply at macosforge.org
Wed Sep 10 12:04:15 PDT 2008
#125: Problem with CSV library
-------------------------------------+--------------------------------------
Reporter: deepak.gulati at gmail.com | Owner: lsansonetti at apple.com
Type: defect | Status: new
Priority: major | Milestone: MacRuby 0.4
Component: MacRuby | Keywords: CSV
-------------------------------------+--------------------------------------
Here is a simple program that reads a CSV files and prints the various
"fields" in it:
require 'CSV'
CSV.foreach("books.csv", headers: true) do |row|
puts "#{row["Name"]}, #{row["Price"]}"
end
With Ruby 1.9.0 (2008-07-25 revision 18217), it runs fine, but with
macruby, I get the following error:
/Library/Frameworks/MacRuby.framework/Versions/0.3/usr/lib/ruby/1.9.0/CSV.rb:1471:in
`each': no block given (yield) (LocalJumpError)
from
/Library/Frameworks/MacRuby.framework/Versions/0.3/usr/lib/ruby/1.9.0/CSV.rb:1021:in
`block in foreach'
from
/Library/Frameworks/MacRuby.framework/Versions/0.3/usr/lib/ruby/1.9.0/CSV.rb:1193:in
`open'
from
/Library/Frameworks/MacRuby.framework/Versions/0.3/usr/lib/ruby/1.9.0/CSV.rb:1020:in
`foreach'
from csvtest.rb:2:in `foreach:headers:'
from csvtest.rb:2:in `<main>'
Is the CSV library included with macruby, incompatible with ruby 1.9?
p.s. "books.csv" looks like this:
Name,Price
Gone with the wind,100.12
Who stole my cheese,104.22
Cocoa Programming with Aaron Hillegasse,42.31
I am attaching both the program and CSV file because the code doesn't look
like in the ticket's preview.
--
Ticket URL: <http://www.macruby.org/trac/ticket/125>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list