Project

General

Profile

Actions

Bug #6302

closed

irb で math-mode 中でも conf.math_mode に nil を代入すると math-mode を抜ける事ができる

Added by sho-h (Sho Hashimoto) about 12 years ago. Updated over 11 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]
Backport:
[ruby-dev:45518]

Description

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
    
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0