私の質問はこの質問に基づいています:Ruby Koan:定数はシンボルになります。私は次のコードを持っています:
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
正解は次のようになっていますか?
assert_equal true, all_symbols.include?("RubyConstant".to_sym)
私はこれをするべきではないことを知っています:
assert_equal true, all_symbols.include?(:RubyConstant)
それなら私はそこに何でも入れることができましたそしてそれはまだ本当でしょう
assert_equal true, all_symbols.include?(:DoesNotMatter)
簡単な「はい」または「いいえ」の質問をすることについて、事前に謝罪します。私は「正しい」答えが何であるかを知りたいと思いました。私は上記の前の投稿のコメントでこの質問をすることを好んだでしょうが、私は別の投稿をしなければできませんでした。