Skip to content

Instantly share code, notes, and snippets.

@hindenbug
Created July 21, 2011 07:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hindenbug/1096749 to your computer and use it in GitHub Desktop.
Save hindenbug/1096749 to your computer and use it in GitHub Desktop.
Using CSV Ruby 1.8 and Ruby 1.9
# in Gemfile
gem "fastercsv", :platforms => [:mri_18, :ruby_18]
# in app/config/environment.rb
require "csv"
unless !CSV.const_defined? :Reader
require "fastercsv"
Object.send(:remove_const, :CSV)
CSV = FasterCSV
end
#if CSV.const_defined? :Reader
# require "fastercsv" #for ruby 1.8
# Object.send(:remove_const, :CSV)
# CSV = FasterCSV
#else
# # use CSV for ruby 1.9
#end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment