2002-07-09 07:17:17 -04:00
|
|
|
#
|
|
|
|
# math-mode.rb -
|
2005-04-13 11:27:09 -04:00
|
|
|
# $Release Version: 0.9.5$
|
2002-07-09 07:17:17 -04:00
|
|
|
# $Revision$
|
2005-04-13 11:27:09 -04:00
|
|
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
2002-07-09 07:17:17 -04:00
|
|
|
#
|
|
|
|
# --
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
require "mathn"
|
|
|
|
|
|
|
|
module IRB
|
|
|
|
class Context
|
|
|
|
attr_reader :math_mode
|
|
|
|
alias math? math_mode
|
|
|
|
|
|
|
|
def math_mode=(opt)
|
|
|
|
if @math_mode == true && opt == false
|
2003-02-07 14:00:21 -05:00
|
|
|
IRB.fail CantReturnToNormalMode
|
2002-07-09 07:17:17 -04:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
@math_mode = opt
|
|
|
|
if math_mode
|
|
|
|
main.extend Math
|
|
|
|
print "start math mode\n" if verbose?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def inspect?
|
|
|
|
@inspect_mode.nil? && !@math_mode or @inspect_mode
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|