lib/em-proxy/proxy.rb in em-proxy-0.1.3 vs lib/em-proxy/proxy.rb in em-proxy-0.1.4
- old
+ new
@@ -1,21 +1,21 @@
-class Proxy
-
- def self.start(options, &blk)
- EM.epoll
- EM.run do
-
- trap("TERM") { stop }
- trap("INT") { stop }
-
- EventMachine::start_server(options[:host], options[:port],
- EventMachine::ProxyServer::Connection, options) do |c|
- blk.call(c)
- end
- end
- end
-
- def self.stop
- puts "Terminating ProxyServer"
- EventMachine.stop
- end
-end
+class Proxy
+
+ def self.start(options, &blk)
+ EM.epoll
+ EM.run do
+
+ trap("TERM") { stop }
+ trap("INT") { stop }
+
+ EventMachine::start_server(options[:host], options[:port],
+ EventMachine::ProxyServer::Connection, options) do |c|
+ c.instance_eval(&blk)
+ end
+ end
+ end
+
+ def self.stop
+ puts "Terminating ProxyServer"
+ EventMachine.stop
+ end
+end