mod = Module.new mod.module_eval do EVAL_CONST = 100 end puts "EVAL_CONST is defined? #{mod.const_defined?(:EVAL_CONST, false)}" puts "EVAL_CONST is defined? #{Object.const_defined?(:EVAL_CONST, false)}"
この出力結果が
EVAL_CONST is defined? false
EVAL_CONST is defined? true
になるのですが、これはどういう動きをしているのでしょうか?
プログラムの順番などで説明していただけると助かります。何卒よろしくお願いします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。