Sha256: be8cd1f9b3998b337567540f0cab938ae7faf6d3d76fc948e70273bb42a1a9a2
Contents?: true
Size: 929 Bytes
Versions: 2
Compression:
Stored size: 929 Bytes
Contents
require 'rubygems' require 'rack' module Rack class ActorMap def initialize(actor) @actor = actor.start end def call( env ) response = Rack::Response.new request = Rack::Request.new(env) message = request.params["message"] response.write @actor << message response.finish end end end module Ara module Remote def self.server(host, port) return Server.new(host, port) end class Server def initialize(host, port) @host = host @port = port @routes = {} end def register(route, actor) @routes["/#{route}"] = Rack::ActorMap.new(actor) self end def start app = Rack::URLMap.new(@routes) app = Rack::ContentLength.new(app) Rack::Handler::WEBrick.run( app, {:Port => @port} ) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ara-0.0.3 | lib/ara/remote.rb |
ara-0.0.2 | lib/ara/remote.rb |