我似乎无法弄清楚这一点。我有以下课程:
class CSV_Email
attr_accessor :client_array, :email_array
def load(file)
@file = file
#Parse csv file into ruby arrays...
#Column Headers - Email, Client
@client_array = []
@email_array = []
CSV.foreach(file, :col_sep => ",", :headers => :first_row, :return_headers => false) do |column|
client_array << column[0]
email_array << column[1]
end
end
end
现在我需要访问client_id_array
和email_array
. 我试过这个:
test = CSV_Email.new
test.load("Email_Test.csv")
puts client_array
但我收到一个undefined local variable client_array
错误。如何访问该变量?
我正在使用红宝石 1.9.3。