这是我的示例代码
:key1 => "a"
:key2 => "b"
:key3 => "c"
array1 = [[:key1, :key1, :key1],[:key1, :key2, :key3],[:key2, :key2, :key1]]
array1.each { |x| if x.sym_tos == "a"
puts "All match!"
else
puts "no match"
end
}
然而,当我运行它时,我得到以下错误代码: undefined method `sym_to_s' for [:R1C1, :R1C2, :R1C3]:Array (NoMethodError)