module Roda::RodaPlugins::SprocketAssets::RequestMethods

Public Instance Methods

sprocket_assets() click to toggle source
# File lib/roda/plugins/sprocket_assets.rb, line 108
def sprocket_assets
  get self.class.sprocket_assets_regexp do |path|
    opts                       = scope.sprocket_assets_opts
    env_sprockets              = scope.request.env.dup
    env_sprockets['PATH_INFO'] = path

    status, headers, response = opts[:sprockets].call env_sprockets

    scope.response.status = status
    scope.response.headers.merge! headers
    response.is_a?(Array) ? response.join('\n') : response.to_s
  end
end