Sha256: 72331fb30c047b3540bbfcdfe5fc3260b92ae25fe16d54a7c4762853fb3ca8b9
Contents?: true
Size: 859 Bytes
Versions: 1
Compression:
Stored size: 859 Bytes
Contents
require "autoirb/version" module Autoirb @repl ||= :irb if File.exist?($0) script = File.binread($0) encoding = "utf-8" if script.match(/\A(?:#!.*\R)?#.*coding *[:=] *(?<encoding>[^\s:]+)/) encoding = Regexp.last_match(:encoding) end script.force_encoding(encoding) last_binding = nil tracepoint = TracePoint.trace(:raise) do |tp| last_binding = tp.binding unless File.expand_path(tp.path) == File.expand_path(__FILE__) end begin TOPLEVEL_BINDING.eval(script, $0, 1) rescue => exception begin tracepoint.disable $stderr.write exception.full_message if last_binding require @repl.to_s unless last_binding.respond_to?(@repl) last_binding.public_send(@repl) end rescue raise exception end end exit end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
autoirb-0.1.0 | lib/autoirb.rb |