Sha256: 884ff9c2f484b0eaed3139b4db7fda9c9a2acb69a644b29a7992f3eab3e8cfe1

Contents?: true

Size: 478 Bytes

Versions: 1

Compression:

Stored size: 478 Bytes

Contents

require "sprockets"

module Penguin
  class Sprockets
    PREFIX = %r{/assets}

    def initialize(app)
      @app = app
      @sprockets = ::Sprockets::Environment.new
      yield @sprockets if block_given?
    end

    def call(env)
      path_info = env["PATH_INFO"]
      if path_info =~ PREFIX
        env["PATH_INFO"].sub!(PREFIX, "")
        @sprockets.call(env)
      else
        @app.call(env)
      end
    ensure
      env["PATH_INFO"] = path_info
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
penguin-0.0.1.beta1 lib/penguin/sprockets.rb