Sha256: 709ff01a433a51e8d1c1c69a537560e991a65d44101d66c7583787e591058d79

Contents?: true

Size: 462 Bytes

Versions: 1

Compression:

Stored size: 462 Bytes

Contents

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"] == "/components.js"
        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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
golf-0.0.8 lib/golf/rack.rb