Class: Protobuf::Rpc::SocketRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/protobuf/rpc/servers/socket_runner.rb

Class Method Summary collapse

Class Method Details

.run(server) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/protobuf/rpc/servers/socket_runner.rb', line 10

def self.run(server)
  Protobuf::Logger.info "SocketServer Running"
  server_config = case 
                  when server.is_a?(OpenStruct) then 
                    server.marshal_dump
                  when server.is_a?(Hash) then
                    server
                  when server.respond_to?(:to_hash) then
                    server.to_hash
                  else
                    raise "Cannot parser Socket Server - server options"
                  end

  Protobuf::Rpc::SocketServer.run(server_config)
end

.stopObject



5
6
7
8
# File 'lib/protobuf/rpc/servers/socket_runner.rb', line 5

def self.stop
  Protobuf::Rpc::SocketServer.stop 
  Protobuf::Logger.info 'Shutdown complete'
end