Friday, November 16, 2012

CSV reader syntax change in Ruby 1.8.7 and Ruby 1.9.2

The way CSV file is opened in Ruby 1.8.7 and in Ruby 1.9.2 are different, here are the syntax:


@parsed_file = CSV::Reader.parse(File.open(restaurant_file, "rb"))
when running from ruby 1.8.7

new
@parsed_file = CSV.read(restaurant_file)
when running from ruby 1.9.2

No comments:

Post a Comment