Projects
Home     Blog     Install     New Ticket     View Tickets     Browse Source

Ticket #125 (new defect)

Opened 3 months ago

Problem with CSV library

Reported by: deepak.gulati@… Owned by: lsansonetti@…
Priority: major Milestone: MacRuby 0.4
Component: MacRuby Keywords: CSV
Cc:

Description

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 "#{rowName?}, #{rowPrice?}"

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.

Attachments

csvtest.rb (108 bytes) - added by deepak.gulati@… 3 months ago.
books.csv (110 bytes) - added by deepak.gulati@… 3 months ago.

Change History

Changed 3 months ago by deepak.gulati@…

Changed 3 months ago by deepak.gulati@…

Note: See TracTickets for help on using tickets.