Permalink
Browse files

added async instructions

  • Loading branch information...
1 parent d4ff339 commit f2a3bdeeff7b3c2ac834344be111450f2bc59b56 Josh Hull committed Jan 18, 2011
Showing with 14 additions and 2 deletions.
  1. +13 −1 README.markdown
  2. +1 −1 lib/apiary/async_response.rb
View
@@ -35,4 +35,16 @@ And you'll get back
74.21
-Currently, `get`, `post`, `put` and `delete` are supported. You can also supply a path after any verb to have a custom path. Also, the current Rack env hash is available under `rack_env` if you need to take a look at the current request.
+Currently, `get`, `post`, `put` and `delete` are supported. You can also supply a path after any verb to have a custom path. Also, the current Rack env hash is available under `rack_env` if you need to take a look at the current request.
+
+## Async Usage
+
+If you want to use this in async mode, put an `a` in front of the method annotation. For instance
+
+ aget
+ def c2f(val)
+ EM.add_timer(0.1) do
+ async_response << "The temperature is :"
+ async_response.end(Float(val) * 9 / 5 + 32)
+ end
+ end
@@ -3,7 +3,7 @@
module Apiary
class AsyncResponse < Thin::AsyncResponse
def end(out = nil)
- self.<<(out) if out
+ self.<<(out.to_s) if out
done
end
end

0 comments on commit f2a3bde

Please sign in to comment.