Class: MF::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/mf.rb

Instance Method Summary collapse

Constructor Details

#initializeServer

Returns a new instance of Server.



22
23
24
# File 'lib/mf.rb', line 22

def initialize
  @sock = UNIXServer.new(SOCKFILE)
end

Instance Method Details

#handle(fd) ⇒ Object



30
31
32
33
# File 'lib/mf.rb', line 30

def handle(fd)
  command, *args = fd.gets.split
  send(command, *args) if self.responds_to?(command)
end

#runObject



26
27
28
# File 'lib/mf.rb', line 26

def run
  handle @sock.accept
end