i'm a ruby nube and i'm trying to build an array of php array functions from a csv file; for each element in the array i would like to enclose each with double quotes; here's my code:
myFile = Array.new
myFile = File.open("C:/my_ruby_code/list_of_php_array_functions.txt")
myFile.each_with_index do |line, index|
line = line.strip
concatenated_line = '"'+line+'"'
#myFile[index] = concatenated_line #<----this is the offending line! for some reason it won't let me reassign a value for this slot!!
puts "#{index} array item: #{line}"
puts "#{index} array item: #{concatenated_line}"
end
OUTPUT, this is the output when i leave the # comment on the line above:
0 array item: array_change_key_case
0 array item: "array_change_key_case"
1 array item: array_chunk
1 array item: "array_chunk"
2 array item: array_combine
2 array item: "array_combine"
3 array item: array_count_values
3 array item: "array_count_values"
4 array item: array_diff_assoc
4 array item: "array_diff_assoc"
5 array item: array_ diff_key
5 array item: "array_ diff_key"
Your help is much appreciated. Thanks all!
Everything depends on the key, the whole key, and nothing but the key so help me Codd.