Class: CodenjoyRubyClient
- Inherits:
-
Object
- Object
- CodenjoyRubyClient
- Defined in:
- lib/codenjoy_ruby_client.rb
Class Method Summary collapse
Class Method Details
.run(host = '0.0.0.0', port = 8888, &answer) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/codenjoy_ruby_client.rb', line 4 def self.run(host='0.0.0.0', port=8888, &answer) codenjoy_server = lambda do |env| decoded_query = URI.decode_www_form env['QUERY_STRING'] query = Hash[decoded_query] [200, {"Content-Type" => "text/plain"}, [answer.call(query)]] end Rack::Handler::WEBrick.run codenjoy_server, Host: host, Port: port end |