我指的是Ruby Koans https://github.com/edgecase/ruby_koans/blob/master/src/about_symbols.rb#L26的about_symbols.rb中的这个测试
def test_method_names_become_symbols
symbols_as_strings = Symbol.all_symbols.map { |x| x.to_s }
assert_equal true, symbols_as_strings.include?("test_method_names_become_symbols")
end
# THINK ABOUT IT:
#
# Why do we convert the list of symbols to strings and then compare
# against the string value rather than against symbols?
为什么我们必须首先将该列表转换为字符串?
https://stackoverflow.com/questions/4686097
复制相似问题