Parsing CSV with headers in Ruby? -


this works:

    require 'csv'     file = csv.open(filename)     puts file.shift 

this not:

    require 'csv'     file = csv.open(filename, :headers=>true)     puts file.shift 

i get:

c:/program files (x86)/ironruby 1.1/lib/ruby/1.9.1/csv.rb:2177:in `convert_field s': undefined method `with_index' ironruby.builtins.enumerator:enumerator (n omethoderror)     c:/program files (x86)/ironruby 1.1/lib/ruby/1.9.1/csv.rb:2218:in ` parse_headers'     c:/program files (x86)/ironruby 1.1/lib/ruby/1.9.1/csv.rb:1918:in ` shift'     c:/program files (x86)/ironruby 1.1/lib/ruby/1.9.1/csv.rb:1818:in ` loop'     c:/program files (x86)/ironruby 1.1/lib/ruby/1.9.1/csv.rb:1818:in ` shift'     c:/myproject/myproject/myproject/program.rb:3 

i using ironruby 1.1.3

i looking correct syntax single line headers option.

i tested in different engine , seems bug in ironruby


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -