Module: IRB

Defined in:
lib/irb.rb,
lib/irb/help.rb,
lib/irb/init.rb,
lib/irb/color.rb,
lib/irb/debug.rb,
lib/irb/frame.rb,
lib/irb/pager.rb,
lib/irb/locale.rb,
lib/irb/command.rb,
lib/irb/context.rb,
lib/irb/history.rb,
lib/irb/version.rb,
lib/irb/debug/ui.rb,
lib/irb/lc/error.rb,
lib/irb/notifier.rb,
lib/irb/ruby-lex.rb,
lib/irb/inspector.rb,
lib/irb/statement.rb,
lib/irb/workspace.rb,
lib/irb/command/cd.rb,
lib/irb/command/ls.rb,
lib/irb/completion.rb,
lib/irb/easter-egg.rb,
lib/irb/ext/loader.rb,
lib/irb/ext/tracer.rb,
lib/irb/lc/ja/error.rb,
lib/irb/command/base.rb,
lib/irb/command/chws.rb,
lib/irb/command/edit.rb,
lib/irb/command/exit.rb,
lib/irb/command/help.rb,
lib/irb/command/info.rb,
lib/irb/command/load.rb,
lib/irb/command/next.rb,
lib/irb/command/step.rb,
lib/irb/input-method.rb,
lib/irb/color_printer.rb,
lib/irb/command/break.rb,
lib/irb/command/catch.rb,
lib/irb/command/debug.rb,
lib/irb/ext/change-ws.rb,
lib/irb/ext/multi-irb.rb,
lib/irb/helper_method.rb,
lib/irb/output-method.rb,
lib/irb/source_finder.rb,
lib/irb/command/delete.rb,
lib/irb/command/finish.rb,
lib/irb/command/pushws.rb,
lib/irb/command/subirb.rb,
lib/irb/ext/use-loader.rb,
lib/irb/ext/workspaces.rb,
lib/irb/nesting_parser.rb,
lib/irb/command/context.rb,
lib/irb/command/history.rb,
lib/irb/command/measure.rb,
lib/irb/command/continue.rb,
lib/irb/command/irb_info.rb,
lib/irb/command/show_doc.rb,
lib/irb/command/whereami.rb,
lib/irb/default_commands.rb,
lib/irb/ext/eval_history.rb,
lib/irb/command/backtrace.rb,
lib/irb/command/force_exit.rb,
lib/irb/helper_method/base.rb,
lib/irb/helper_method/conf.rb,
lib/irb/command/disable_irb.rb,
lib/irb/command/show_source.rb,
lib/irb/command/internal_helpers.rb

Overview

history.rb - by Keiju ISHITSUKA([email protected])

Defined Under Namespace

Modules: Color, Command, Debug, ExtendCommandBundle, HelperMethod, HelpersContainer, History, HistorySavingAbility, InputCompletor, IrbLoader, NestingParser, Notifier Classes: Abort, BaseCompletor, CallTracer, CantChangeBinding, CantReturnToNormalMode, Canvas, ColorPrinter, Context, EvalHistory, FileInputMethod, Frame, IRB, IllegalParameter, InputMethod, Inspector, Irb, IrbAlreadyDead, IrbSwitchedToCurrentThread, JobManager, LoadAbort, Locale, NoSuchJob, OutputMethod, Pager, ReadlineInputMethod, RegexpCompletor, ReidlineInputMethod, RelineInputMethod, RubyLex, RubyModel, SourceFinder, Statement, StdioInputMethod, StdioOutputMethod, TypeCompletor, UndefinedPromptMode, UnrecognizedSwitch, Vec, WorkSpace

Constant Summary collapse

VERSION =

:nodoc:

"1.14.3"
TOPLEVEL_BINDING =
binding
ExtendCommand =
Command
IRBRC_EXT =
"rc"

Class Method Summary collapse

Class Method Details

.CurrentContextObject

The current Context in this session



890
891
892
# File 'lib/irb.rb', line 890

def CurrentContext # :nodoc:
  conf[:MAIN_CONTEXT]
end

.inspectObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/irb/init.rb', line 19

def @CONF.inspect
  array = []
  for k, v in sort{|a1, a2| a1[0].id2name <=> a2[0].id2name}
    case k
    when :MAIN_CONTEXT, :__TMP__EHV__
      array.push format("CONF[:%s]=...myself...", k.id2name)
    when :PROMPT
      s = v.collect{
        |kk, vv|
        ss = vv.collect{|kkk, vvv| ":#{kkk.id2name}=>#{vvv.inspect}"}
        format(":%s=>{%s}", kk.id2name, ss.join(", "))
      }
      array.push format("CONF[:%s]={%s}", k.id2name, s.join(", "))
    else
      array.push format("CONF[:%s]=%s", k.id2name, v.inspect)
    end
  end
  array.join("\n")
end

.irb_abort(irb, exception = Abort) ⇒ Object

Aborts then interrupts irb.

Will raise an Abort exception, or the given exception.



917
918
919
# File 'lib/irb.rb', line 917

def irb_abort(irb, exception = Abort) # :nodoc:
  irb.context.thread.raise exception, "abort then interrupt!"
end

.irb_exitObject

Quits irb



910
911
912
# File 'lib/irb.rb', line 910

def irb_exit(*) # :nodoc:
  throw :IRB_EXIT, false
end

.start(ap_path = nil) ⇒ Object

Initializes IRB and creates a new Irb.irb object at the TOPLEVEL_BINDING



895
896
897
898
899
900
901
902
903
904
905
906
907
# File 'lib/irb.rb', line 895

def start(ap_path = nil)
  STDOUT.sync = true
  $0 = File::basename(ap_path, ".rb") if ap_path

  setup(ap_path)

  if @CONF[:SCRIPT]
    irb = Irb.new(nil, @CONF[:SCRIPT])
  else
    irb = Irb.new
  end
  irb.run(@CONF)
end