From 04f0bad2ee8d9173fcf6feb7acca7fe4695ad65a Mon Sep 17 00:00:00 2001 From: ujihisa Date: Sun, 10 Oct 2010 15:14:30 -0700 Subject: [PATCH] fastercsv is only for 1.8 --- Gemfile | 2 +- Gemfile.lock | 2 -- lib/translink.rb | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index ede6665..3a5681a 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,7 @@ gem 'httparty' gem 'json' -gem 'fastercsv' +gem 'fastercsv' if RUBY_VERSION < '1.9' # Use unicorn as the web server # gem 'unicorn' diff --git a/Gemfile.lock b/Gemfile.lock index cac5989..908eee9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -38,7 +38,6 @@ GEM warden (~> 0.10.7) erubis (2.6.6) abstract (>= 1.0.0) - fastercsv (1.5.3) haml (3.0.21) httparty (0.6.1) crack (= 0.1.8) @@ -82,7 +81,6 @@ PLATFORMS DEPENDENCIES devise - fastercsv haml httparty json diff --git a/lib/translink.rb b/lib/translink.rb index 3d9b0fe..933edb9 100644 --- a/lib/translink.rb +++ b/lib/translink.rb @@ -1,6 +1,6 @@ require 'httparty' require 'json' -require 'fastercsv' +require RUBY_VERSION < '1.9' ? 'fastercsv' : 'csv' require 'pp' # we can use cron to update the schedule every 40 minutes (or something) @@ -35,7 +35,7 @@ def csv # "stop_url"=>" ", # "stop_desc"=>"BEACH AV @ NICOLA ST", # "stop_name"=>"EB BEACH AV FS NICOLA ST"} - FasterCSV.open("data/stops.txt",:headers => true).each do |row| + (RUBY_VERSION < '1.9' ? FasterCSV : CSV).open("data/stops.txt",:headers => true).each do |row| @csv[row["stop_code"].to_i] = row.to_hash end @csv