我有驗證CSV文件是否正確的代碼。我想編寫慣用代碼來檢查列是否正確。我不想寫在塊檢查,如果我們有第一線檢查列。CSV驗證列
CSV.foreach(@csv) { |person|
first_name, last_name, person_id, email, title, phone, mobile, department, address, city = person[0..9]
zip_code, state, country, manager_id =person[10..13]
@managers << manager_id
@persons << person_id
validate = false unless validate_email(email)
validate = false unless validate_first_name(first_name)
validate = false unless validate_last_name(last_name)
validate = false unless validate_person_id(person_id)
}