module Utils::IRB::Service

def connect(hostname = nil, port = nil)

def connect(hostname = nil, port = nil)
  hostname ||= self.hostname
  port     ||= self.port
  uri = "druby://#{hostname}:#{port}"
  irb = DRbObject.new_with_uri(uri)
  Proxy.new(irb)
end

def start(hostname = nil, port = nil, &block)

def start(hostname = nil, port = nil, &block)
  hostname ||= self.hostname
  port     ||= self.port
  block    ||= proc {}
  uri = "druby://#{hostname}:#{port}"
  puts "Starting IRB server listening to #{uri.inspect}."
  DRb.start_service(uri, eval('irb_current_working_binding', block.binding))
end