From b149580632d2f5f6cfe8a6e028028ef85acafaee Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Tue, 10 Mar 2015 23:25:31 -0400 Subject: Silence method redefinition warning --- Library/Homebrew/debrew/irb.rb | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/debrew/irb.rb b/Library/Homebrew/debrew/irb.rb index c3a16c046..8d81558b1 100644 --- a/Library/Homebrew/debrew/irb.rb +++ b/Library/Homebrew/debrew/irb.rb @@ -3,31 +3,33 @@ require 'irb' module IRB @setup_done = false - def IRB.parse_opts - end - - def IRB.start_within(binding) - unless @setup_done - IRB.setup(nil) - @setup_done = true + extend Module.new { + def parse_opts end - workspace = WorkSpace.new(binding) - irb = Irb.new(workspace) + def start_within(binding) + unless @setup_done + setup(nil) + @setup_done = true + end - @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC] - @CONF[:MAIN_CONTEXT] = irb.context + workspace = WorkSpace.new(binding) + irb = Irb.new(workspace) - trap("SIGINT") do - irb.signal_handle - end + @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC] + @CONF[:MAIN_CONTEXT] = irb.context + + trap("SIGINT") do + irb.signal_handle + end - begin - catch(:IRB_EXIT) do - irb.eval_input + begin + catch(:IRB_EXIT) do + irb.eval_input + end + ensure + irb_at_exit end - ensure - irb_at_exit end - end + } end -- cgit v1.2.3