lib/cuba.rb in cuba-0.2.0 vs lib/cuba.rb in cuba-0.3.0
- old
+ new
@@ -1,20 +1,29 @@
require "cuba/version"
require "cuba/ron"
module Cuba
+ def self.reset!
+ @app = nil
+ @prototype = nil
+ end
+
def self.app
@app ||= Rack::Builder.new
end
- def self.use(middleware)
- app.use(middleware)
+ def self.use(middleware, *args, &block)
+ app.use(middleware, *args, &block)
end
def self.define(&block)
app.run Cuba::Ron.new(&block)
end
+ def self.prototype
+ @prototype ||= app.to_app
+ end
+
def self.call(env)
- app.call(env)
+ prototype.call(env)
end
-end
+end
\ No newline at end of file