2013-01-05 4 views
2

저는 Ruby를 처음 접했고이 코드는 https://github.com/drodriguez/reversegeocoding이며 정말 멋지다고 생각합니다.오프라인 역 지오 코딩 iOS

/Users/xyz/.thor/f892c2a1d732c61bbf4ebff2abb70df6:194:in `initialize': wrong number of arguments(2 for 0) (ArgumentError) 

라인 (194)

csv = FasterCSV.new(io, CSV_OPTIONS.merge(COUNTRIES_CSV_OPTIONS)) 

를 표시하고 전체 방법

: 나는
thor geocoder:database 

를 호출하고있어 그래서 난이 오류가 샘플 응용 프로그램을 시도 모두를 설치하지만,
def insert_countries(db, countries) 
ids = Hash.new 
country_insert = db.prepare("INSERT INTO countries (name) VALUES (:name)") 
open(countries, 'rb') do |io| 
    io.rewind unless io.read(3) == "\xef\xbb\xbf" # Skip UTF-8 marker 
    io.readline while io.read(1) == '#' # Skip comments at the start of the file 
    io.seek(-1, IO::SEEK_CUR) # Unread the last character that wasn't '#' 
    csv = FasterCSV.new(io, CSV_OPTIONS.merge(COUNTRIES_CSV_OPTIONS)) 
    csv.each do |row| 
    country_insert.execute :name => row['country'] 
    ids[row['ISO']] = db.last_insert_row_id 
    end 
end 
country_insert.close 

ids 
end 

이 문제를 해결하는 방법을 모르고 누군가가이 문제를 해결할 수 있기를 바랍니다.

감사합니다.

답변

1

해결책을 찾았습니다. 문제는 내 루비 버전이었다. 1.9.x FasterCSV는 더 이상 지원되지 않으며 현재 CSV는 Ruby 표준 라이브러리에 있습니다. 참조 번호는 https://stackoverflow.com/a/6090840/749242

입니다.