Module: Utils::IRB::Service

Defined in:
lib/utils/irb.rb

Defined Under Namespace

Classes: Proxy

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.hostnameObject

Returns the value of attribute hostname.



445
446
447
# File 'lib/utils/irb.rb', line 445

def hostname
  @hostname
end

.portObject

Returns the value of attribute port.



447
448
449
# File 'lib/utils/irb.rb', line 447

def port
  @port
end

Class Method Details

.connect(hostname = nil, port = nil) ⇒ Object



458
459
460
461
462
463
464
# File 'lib/utils/irb.rb', line 458

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

.start(hostname = nil, port = nil, &block) ⇒ Object



449
450
451
452
453
454
455
456
# File 'lib/utils/irb.rb', line 449

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