This works:
require 'csv'
file = CSV.open(filename)
puts file.shift
This does 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' for IronRuby.Builtins.Enumerator:Enumerator (N
oMethodError)
from C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/csv.rb:2218:in `
parse_headers'
from C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/csv.rb:1918:in `
shift'
from C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/csv.rb:1818:in `
loop'
from C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/1.9.1/csv.rb:1818:in `
shift'
from C:/myproject/myproject/myproject/Program.rb:3
I am using Ironruby 1.1.3
I am looking for the correct syntax to get a single line with the headers option.
I tested this in a different engine and this seems to be a bug in Ironruby