Module: Roda::RodaPlugins::SprocketAssets::RequestMethods

Defined in:
lib/roda/plugins/sprocket_assets.rb

Instance Method Summary collapse

Instance Method Details

#sprocket_assetsObject



108
109
110
111
112
113
114
115
116
117
118
119
120
# 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