Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make more asynchronous

  • Loading branch information...
commit 0cfe86de5b3e919e2beb86a9bed6b24d53d821f7 1 parent 15d5235
@rf- authored
Showing with 10 additions and 4 deletions.
  1. +1 −1  lib/pry-notebook/pry.rb
  2. +9 −3 lib/pry-notebook/server.rb
View
2  lib/pry-notebook/pry.rb
@@ -67,7 +67,7 @@ def subscribe(identifier, receiver = [])
end
def unsubscribe(identifier)
- @subscribers[identifier] = nil
+ @subscribers.delete(identifier)
end
def eval(str)
View
12 lib/pry-notebook/server.rb
@@ -2,7 +2,13 @@
require 'json'
require 'rack/builder'
+require 'pry-notebook/pry'
+
module Pry::Notebook
+ class Pry
+ include Celluloid
+ end
+
class Server < Reel::Server
class Client
include Celluloid
@@ -10,9 +16,9 @@ class Client
def initialize(socket, pry)
@socket = socket
- @pry = pry
+ @pry = pry.async
- @pry.subscribe self.object_id, self
+ @pry.subscribe self.object_id, self.async
end
def <<(obj)
@@ -57,7 +63,7 @@ def on_connection(connection)
case request.method.to_s
when "post"
info "Evaluating #{request.body.inspect}"
- @pry.eval request.body
+ @pry.async.eval request.body
connection.respond :ok, "OK"
when "get"
resp = GetHandler.call(rack_env(request))
Please sign in to comment.
Something went wrong with that request. Please try again.