Class: Culerity::CelerityServer
- Inherits:
-
Object
- Object
- Culerity::CelerityServer
- Defined in:
- lib/culerity/celerity_server.rb
Instance Method Summary collapse
-
#initialize(_in, _out) ⇒ CelerityServer
constructor
A new instance of CelerityServer.
Constructor Details
#initialize(_in, _out) ⇒ CelerityServer
Returns a new instance of CelerityServer.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/culerity/celerity_server.rb', line 8 def initialize(_in, _out) @proxies = {} @browsers = [] while(true) call = eval _in.gets.to_s.strip return if call == ["_exit_"] next(close_browsers) if call == ["_close_browsers_"] unless call.nil? begin # check if last arg is a block if call.last.is_a?(Proc) # pass as &call[-1] result = target(call.first).send call[1], *call[2..-2], &call[-1] else # just call with args as normal result = target(call.first).send call[1], *call[2..-1] end _out << "[:return, #{proxify result}]\n" rescue => e _out << "[:exception, \"#{e.class.name}\", #{e..inspect}, #{e.backtrace.inspect}]\n" end end end end |