From b149580632d2f5f6cfe8a6e028028ef85acafaee Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Tue, 10 Mar 2015 23:25:31 -0400 Subject: [PATCH] Silence method redefinition warning --- Library/Homebrew/debrew/irb.rb | 48 ++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/Library/Homebrew/debrew/irb.rb b/Library/Homebrew/debrew/irb.rb index c3a16c0465..8d81558b10 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) - - @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 + def start_within(binding) + unless @setup_done + setup(nil) + @setup_done = true + end + + workspace = WorkSpace.new(binding) + irb = Irb.new(workspace) + + @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 + end + ensure + irb_at_exit end - ensure - irb_at_exit end - end + } end