Class: BitClust::Server

Inherits:
Object show all
Defined in:
lib/bitclust/server.rb

Overview

Body of Refe server (spanwed by ‘refe –server`).

Instance Method Summary collapse

Constructor Details

#initialize(db) ⇒ Server

Returns a new instance of Server.



24
25
26
# File 'lib/bitclust/server.rb', line 24

def initialize(db)
  @db = db
end

Instance Method Details

#listen(url, foreground = false) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/bitclust/server.rb', line 28

def listen(url, foreground = false)
  begin
    require 'webrick/server'
  rescue LoadError
    abort "webrick is not found. You may need to `gem install webrick` to install webrick."
  end
  WEBrick::Daemon.start unless foreground
  DRb.start_service url, @db
  DRb.thread.join
end