我在Ruby Koans的about_symbols.rb中指的是此测试 https://github.com/edgecase/ruby_koans/blob/master/src/about_symbols.rb#L26
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?
为什么我们必须首先将那个列表转换成字符串呢?
Symbol.all_symbols
变量,然后测试是否包含。符号在比较时速度更快,并且避免了将数千个符号转换为字符串。