[MacRuby] #1103: csv.rb oddity

MacRuby ruby-noreply at macosforge.org
Thu Jan 6 17:41:03 PST 2011


#1103: csv.rb oddity
---------------------------------+------------------------------------------
 Reporter:  percent20@…          |       Owner:  lsansonetti@…        
     Type:  defect               |      Status:  new                  
 Priority:  minor                |   Milestone:                       
Component:  MacRuby              |    Keywords:  csv                  
---------------------------------+------------------------------------------

Comment(by watson1978@…):

 {{{
 $ cat test_csv.rb
 CSV.open('save.csv', 'r') do |row|
   puts row[1]
 end

 $ cat save.csv
 John,Smith,john at smith.com,1234567
 John,Smith,john at smith.com,1234567
 John,Smith,john at smith.com,1234567

 $ ruby19 -v -r csv test_csv.rb
 ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0]
 test_csv.rb:2:in `block in <main>': undefined method `[]' for
 #<CSV:0x00000101180c98> (NoMethodError)
         from /usr/local/lib/ruby/1.9.1/csv.rb:1340:in `open'
         from test_csv.rb:1:in `<main>'

 $ irb19
 irb(main):001:0> require 'csv'
 => true
 irb(main):002:0> CSV.open('save.csv', 'r') do |row|
 irb(main):003:1* puts row[1]
 irb(main):004:1> end
 NoMethodError: undefined method `[]' for #<CSV:0x00000101950590>
         from (irb):3:in `block in irb_binding'
         from /usr/local/lib/ruby/1.9.1/csv.rb:1340:in `open'
         from (irb):2
         from /usr/local/bin/irb19:12:in `<main>'
 irb(main):005:0>

 $ ruby -v -r csv test_csv.rb
 ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
 Smith
 Smith
 Smith
 }}}

 In my environment, test code works fine in the CRuby1.8, but even does not
 work in CRuby1.9.

 Is there an error in my procedure?

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



More information about the macruby-tickets mailing list