Parent

Files

Class/Module Index [+]

Quicksearch

God::Socket

The God::Server oversees the DRb server which dishes out info on this God daemon.

Attributes

port[R]

Public Class Methods

new(port = nil, user = nil, group = nil, perm = nil) click to toggle source

Create a new Server and star the DRb server

+port+ is the port on which to start the DRb service (default nil)
# File lib/god/socket.rb, line 41
def initialize(port = nil, user = nil, group = nil, perm = nil)
  @port  = port
  @user  = user
  @group = group
  @perm  = perm
  start
end
socket(port) click to toggle source

The address of the socket for a given port

+port+ is the port number

Returns String (drb address)

# File lib/god/socket.rb, line 21
def self.socket(port)
  "drbunix://#{self.socket_file(port)}"
end
socket_file(port) click to toggle source

The location of the socket for a given port

+port+ is the port number

Returns String (file location)

# File lib/god/socket.rb, line 13
def self.socket_file(port)
  "/tmp/god.#{port}.sock"
end

Public Instance Methods

method_missing(*args, &block) click to toggle source

Forward API calls to God

Returns whatever the forwarded call returns

# File lib/god/socket.rb, line 57
def method_missing(*args, &block)
  God.send(*args, &block)
end
ping() click to toggle source

Returns true

# File lib/god/socket.rb, line 50
def ping
  true
end
socket() click to toggle source

The address of the socket for this Server

Returns String (drb address)

# File lib/god/socket.rb, line 35
def socket
  self.class.socket(@port)
end
socket_file() click to toggle source

The location of the socket for this Server

Returns String (file location)

# File lib/god/socket.rb, line 28
def socket_file
  self.class.socket_file(@port)
end
stop() click to toggle source

Stop the DRb server and delete the socket file

Returns nothing

# File lib/god/socket.rb, line 64
def stop
  DRb.stop_service
  FileUtils.rm_f(self.socket_file)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.