aboutsummaryrefslogtreecommitdiffstats
path: root/lib/irb/ext/math-mode.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irb/ext/math-mode.rb')
-rw-r--r--lib/irb/ext/math-mode.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/irb/ext/math-mode.rb b/lib/irb/ext/math-mode.rb
index 41be79841c..4f3c5c18ba 100644
--- a/lib/irb/ext/math-mode.rb
+++ b/lib/irb/ext/math-mode.rb
@@ -12,9 +12,20 @@ require "mathn"
module IRB
class Context
+ # Returns whether bc mode is enabled.
+ #
+ # See #math_mode=
attr_reader :math_mode
+ # Alias for #math_mode
alias math? math_mode
+ # Sets bc mode, which loads +lib/mathn.rb+ so fractions or matrix are
+ # available.
+ #
+ # Also available as the +-m+ command line option.
+ #
+ # See IRB@Command+line+options and the unix manpage <code>bc(1)</code> for
+ # more information.
def math_mode=(opt)
if @math_mode == true && opt == false
IRB.fail CantReturnToNormalMode