From: "sho-h (Sho Hashimoto)" Date: 2012-04-16T01:54:06+09:00 Subject: [ruby-dev:45518] [ruby-trunk - Bug #6302][Open] irb で math-mode 中でも conf.math_mode に nil を代入すると math-mode を抜ける事ができる Issue #6302 has been reported by sho-h (Sho Hashimoto). ---------------------------------------- Bug #6302: irb で math-mode 中でも conf.math_mode に nil を代入すると math-mode を抜ける事ができる https://bugs.ruby-lang.org/issues/6302 Author: sho-h (Sho Hashimoto) Status: Open Priority: Low Assignee: Category: Target version: ruby -v: ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux] irb では、一度 math-mode になった場合は抜ける事ができない仕様だと思いますが、conf.math_mode に nil を代入すると math-mode を抜ける事ができてしまうようです。(1.9.3-p125 で確認しましたが、trunk でも同様のようです) > conf.math_mode = true => true > conf.math_mode = nil => nil > conf.math_mode = false => false > conf.math_mode = true => true > conf.math_mode = false IRB::CantReturnToNormalMode: Normalモードに戻れません. from (irb):10 from /home/sho-h/.rvm/rubies/ruby-1.9.3-p125/bin/irb:16:in `
' false 以外でも抜ける事ができるように修正するのがよいのではないかと思いました。 --- lib/irb/ext/math-mode.rb (revision 35336) +++ lib/irb/ext/math-mode.rb (working copy) @@ -16,7 +16,7 @@ alias math? math_mode def math_mode=(opt) - if @math_mode == true && opt == false + if @math_mode == true && !opt IRB.fail CantReturnToNormalMode return end -- http://bugs.ruby-lang.org/