lib/golf/rack.rb in golf-0.0.4 vs lib/golf/rack.rb in golf-0.0.5
- old
+ new
@@ -1,14 +1,16 @@
module Golf
class Rack
def initialize(app = nil)
@app = app if app
+ @compiler = Golf::Compiler.new
end
def call(env)
if env["REQUEST_METHOD"] == "GET" and env["PATH_INFO"] == "/component.js"
- ['200', { 'Content-Type' => 'application/javascript', 'Content-Length' => '5'}, ['asasd']]
+ result = @compiler.generate_componentsjs
+ ['200', { 'Content-Type' => 'application/javascript', 'Content-Length' => result.length.to_s}, [result]]
else
@app.call(env) if @app
end
end
end