[MacRuby-devel] [MacRuby] #460: bug in CSV module

MacRuby ruby-noreply at macosforge.org
Fri Nov 27 13:34:45 PST 2009


#460: bug in CSV module
--------------------------------+-------------------------------------------
 Reporter:  nineclue@…          |        Owner:  lsansonetti@…        
     Type:  defect              |       Status:  closed               
 Priority:  blocker             |    Milestone:                       
Component:  MacRuby             |   Resolution:  invalid              
 Keywords:                      |  
--------------------------------+-------------------------------------------
Changes (by eloy.de.enige@…):

  * status:  new => closed
  * resolution:  => invalid


Comment:

 Actually MacRuby conforms exactly to Ruby 1.9.x in this case. Ruby 1.9.x
 is what MacRuby is based on. Your examples do work on Ruby 1.8.7, so I
 guess that's what you were expecting… Nonetheless, if this is a bug,
 please report it upstream so we can pull it in the next time we sync the
 stdlib. Thanks.

 {{{
 % irb19
 irb(main):001:0> require 'csv'
 => true
 irb(main):002:0> a = '1,2,3'
 => "1,2,3"
 irb(main):003:0> CSV.parse(a, ',')
 TypeError: can't convert String into Hash
         from /usr/local/lib/ruby/1.9.1/csv.rb:1548:in `merge'
         from /usr/local/lib/ruby/1.9.1/csv.rb:1548:in `initialize'
         from /usr/local/lib/ruby/1.9.1/csv.rb:1356:in `new'
         from /usr/local/lib/ruby/1.9.1/csv.rb:1356:in `parse'
         from (irb):3
         from /usr/local/bin/irb19:12:in `<main>'

 irb(main):002:0> CSV.open('test.csv', 'r', ',') { |r| puts r }
 TypeError: can't convert String into Integer
         from /usr/local/lib/ruby/1.9.1/csv.rb:1329:in `initialize'
         from /usr/local/lib/ruby/1.9.1/csv.rb:1329:in `open'
         from /usr/local/lib/ruby/1.9.1/csv.rb:1329:in `open'
         from (irb):2
         from /usr/local/bin/irb19:12:in `<main>'
 }}}

 {{{
 % irb
 irb(main):001:0> require 'csv'
 => true
 irb(main):002:0> a = '1,2,3'
 => "1,2,3"
 irb(main):003:0> CSV.parse(a, ',')
 => [["1", "2", "3"]]
 irb(main):004:0> CSV.open('test.csv', 'r', ',') { |r| puts r }
 1
 2
 3
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/460#comment:1>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list