[MacRuby] #125: Problem with CSV library
#125: Problem with CSV library -------------------------------------+-------------------------------------- Reporter: deepak.gulati@gmail.com | Owner: lsansonetti@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/>
#125: Problem with CSV library -------------------------------------+-------------------------------------- Reporter: deepak.gulati@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: MacRuby 0.5 Component: MacRuby | Resolution: fixed Keywords: CSV | -------------------------------------+-------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: MacRuby 0.4 => MacRuby 0.5 Comment: As of trunk r2432, this should work. {{{ $ ./miniruby t.rb Gone with the wind, 100.12 Who stole my cheese, 104.22 Cocoa Programming with Aaron Hillegasse, 42.31 }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/125#comment:1> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby