class OneDrb::Server

Public Class Methods

new(host: '127.0.0.1', port: (49152..65535).to_a.sample.to_s, obj: nil, log: nil) click to toggle source
# File lib/onedrb.rb, line 20
def initialize(host: '127.0.0.1', port: (49152..65535).to_a.sample.to_s, 
                obj: nil, log: nil)

  log.info self.class.to_s + '/initialize: active' if log
  
  @host, @port, @log = host, port, log

  if obj then
    @obj = obj 
  else
    msg = "No object supplied!".error
    puts msg
    raise OneDrbError, msg
  end
  
  log.info self.class.to_s +'/initialize: completed' if log

end

Public Instance Methods

start() click to toggle source
# File lib/onedrb.rb, line 39
def start()

  @log.info self.class.to_s +'/start: active' if @log
  puts (self.class.to_s + " running on port " + @port).info
  DRb.start_service "druby://#{@host}:#{@port}", @obj
  DRb.thread.join

end