A class that wraps the current state of the irb session, including the configuration of IRB.conf.

Constants

IDNAME_IVARS = ["@prompt_mode"]

NO_INSPECTING_IVARS = ["@irb", "@io"]

NOPRINTING_IVARS = ["@last_value"]

Attributes

[R] last_value

The return value of the last statement evaluated.

[RW] echo?

Whether to echo the return value to output or not.

Uses IRB.conf[:ECHO] if available, or defaults to true.

puts "hello"
# hello
#=> nil
IRB.CurrentContext.echo = false
puts "omg"
# omg
[RW] ignore_eof?

Whether ^D (control-d) will be ignored or not.

If set to false, ^D will quit irb.

[RW] ignore_sigint?

Whether ^C (control-c) will be ignored or not.

If set to false, ^C will quit irb.

If set to true,

  • during input: cancel input then return to top level.

  • during execute: abandon current execution.

[RW] rc?

A copy of the default IRB.conf[:RC]

[R] use_readline?

Whether Readline is enabled or not.

A copy of the default IRB.conf[:USE_READLINE]

See #use_readline= for more information.

[RW] back_trace_limit

The limit of backtrace lines displayed as top n and tail n.

The default value is 16.

Can also be set using the --back-trace-limit command line option.

See IRB@Command+line+options for more command line options.

[R] debug_level

The debug level of irb

See #debug_level= for more information.

[RW] verbose

Whether verbose messages are displayed or not.

A copy of the default IRB.conf[:VERBOSE]

[RW] echo

Whether to echo the return value to output or not.

Uses IRB.conf[:ECHO] if available, or defaults to true.

puts "hello"
# hello
#=> nil
IRB.CurrentContext.echo = false
puts "omg"
# omg
[RW] ignore_eof

Whether ^D (control-d) will be ignored or not.

If set to false, ^D will quit irb.

[RW] ignore_sigint

Whether ^C (control-c) will be ignored or not.

If set to false, ^C will quit irb.

If set to true,

  • during input: cancel input then return to top level.

  • during execute: abandon current execution.

[RW] return_format

The format of the return statement, set by #prompt_mode= using the :RETURN of the mode passed to set the current #prompt_mode.

[RW] auto_indent_mode

Can be either the default IRB.conf[:AUTO_INDENT], or the mode set by #prompt_mode=

To enable auto-indentation in irb:

IRB.conf[:AUTO_INDENT] = true

or

irb_context.auto_indent_mode = true

or

IRB.CurrentContext.auto_indent_mode = true

See IRB@Configuration for more information.

[RW] prompt_n

See IRB@Customizing+the+IRB+Prompt for more information.

[RW] prompt_c

IRB prompt for continuated statement (e.g. immediately after an if)

See IRB@Customizing+the+IRB+Prompt for more information.

[RW] prompt_s

IRB prompt for continuated strings

See IRB@Customizing+the+IRB+Prompt for more information.

[RW] prompt_i

Standard IRB prompt

See IRB@Customizing+the+IRB+Prompt for more information.

[R] prompt_mode

A copy of the default IRB.conf[:PROMPT_MODE]

[R] inspect_mode

A copy of the default IRB.conf[:INSPECT_MODE]

[R] use_readline

Whether Readline is enabled or not.

A copy of the default IRB.conf[:USE_READLINE]

See #use_readline= for more information.

[RW] irb_path

Can be either the #irb_name surrounded by parenthesis, or the input_method passed to Context.new

[RW] irb_name

Can be either name from IRB.conf[:IRB_NAME], or the number of the current job set by JobManager, such as irb#2

[RW] load_modules

A copy of the default IRB.conf[:LOAD_MODULES]

[RW] rc

A copy of the default IRB.conf[:RC]

[RW] ap_name

A copy of the default IRB.conf[:AP_NAME]

[RW] irb

Current irb session

[RW] io

The current input method

Can be either StdioInputMethod, ReadlineInputMethod, FileInputMethod or other specified when the context is created. See ::new for more information on input_method.

[R] thread

The current thread in this context

[RW] workspace

WorkSpace in the current context

[R] workspace_home

The toplevel workspace, see #home_workspace

[R] eval_history

The command result history limit.

[R] use_tracer?

Whether Tracer is used when evaluating statements in this context.

See lib/tracer.rb for more information.

[R] use_tracer

Whether Tracer is used when evaluating statements in this context.

See lib/tracer.rb for more information.

Show files where this class is defined (7 files)
Register or log in to add new notes.