summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/irb/context.rb4
-rw-r--r--lib/irb/init.rb16
-rw-r--r--lib/irb/input-method.rb2
-rw-r--r--lib/irb/lc/help-message2
-rw-r--r--test/irb/test_init.rb45
5 files changed, 64 insertions, 5 deletions
@@ -115,6 +115,10 @@ module IRB
end
@io = StdioInputMethod.new unless @io
when String
@io = FileInputMethod.new(input_method)
@irb_name = File.basename(input_method)
@@ -289,6 +289,10 @@ module IRB # :nodoc:
@CONF[:PROMPT_MODE] = prompt_mode
when "--noprompt"
@CONF[:PROMPT_MODE] = :NULL
when "--inf-ruby-mode"
@CONF[:PROMPT_MODE] = :INF_RUBY
when "--sample-book-mode", "--simple-prompt"
@@ -309,16 +313,20 @@ module IRB # :nodoc:
IRB.print_usage
exit 0
when "--"
- if opt = argv.shift
@CONF[:SCRIPT] = opt
$0 = opt
end
break
- when /^-/
fail UnrecognizedSwitch, opt
else
- @CONF[:SCRIPT] = opt
- $0 = opt
break
end
end
@@ -137,7 +137,7 @@ module IRB
# Creates a new input method object
def initialize(file)
super
- @io = IRB::MagicFile.open(file)
@external_encoding = @io.external_encoding
end
# The file name of this input method, usually given during initialization.
@@ -38,6 +38,8 @@ Usage: irb.rb [options] [programfile] [arguments]
--sample-book-mode, --simple-prompt
Set prompt mode to 'simple'.
--noprompt Don't output prompt.
--single-irb Share self with sub-irb.
--tracer Show stack trace for each command.
--back-trace-limit n[=16]
@@ -16,6 +16,7 @@ module TestIRB
def teardown
ENV.update(@backup_env)
FileUtils.rm_rf(@tmpdir)
end
def test_setup_with_argv_preserves_global_argv
@@ -87,6 +88,50 @@ module TestIRB
IRB.conf[:USE_COLORIZE] = orig_use_colorize
end
private
def with_argv(argv)