lib/angelo/responder.rb in angelo-0.2.1 vs lib/angelo/responder.rb in angelo-0.2.2

- old
+ new

@@ -28,24 +28,22 @@ Hash.new {|hash,key| hash[key.to_s] if Symbol === key } end end - attr_accessor :connection - attr_reader :request + attr_accessor :connection, :request attr_writer :base def initialize &block @response_handler = Base.compile! :request_handler, &block end - def request= request + def reset! @params = nil @redirect = nil @body = nil - @request = request - handle_request + @request = nil end def handle_request if @response_handler @base.filter :before @@ -195,9 +193,18 @@ handle_error e, :internal_server_error end def redirect url @redirect = url + end + + def on_close= on_close + raise ArgumentError.new unless Proc === on_close + @on_close = on_close + end + + def on_close + @on_close[] if @on_close end end end