मैं रूबी Koans https://github.com/edgecase/ruby_koans/blob/master/src/about_symbols.rb##2626 में इस परीक्षण का जिक्र कर रहा हूं।
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एक चर के आउटपुट को असाइन करना है , फिर समावेश के लिए परीक्षण करें। प्रतीक तुलना में तेज हैं, और आप हजारों प्रतीकों को तार में बदलने से बच रहे हैं।