公安コード、番号 75:
in_ruby_version("mri") do
RubyConstant = "What is the sound of one hand clapping?"
def test_constants_become_symbols
all_symbols = Symbol.all_symbols
assert_equal __, all_symbols.include?(__)
end
end
「all_symbols.include?(__)」に対してテストされたシンボルはすべて「true」と一致することがわかったので、少し混乱しています。たとえば、次のすべてが機能するはずです。
assert_equal true, all_symbols.include?(:RubyConstant)
assert_equal true, all_symbols.include?(:"What is the sound of one hand clapping?")
assert_equal true, all_symbols.include?(:AnythingElseYouCouldWriteHere)
「constants_become_symbols」で学ぶとは一体何なのか?