Class: Pakyow::Application::Actions::Assets::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/pakyow/application/actions/assets/process.rb

Overview

Pipeline Action that processes assets at request time.

This is intended for development use, please don’t use it in production. Instead, precompile assets into the public directory.

Instance Method Summary collapse

Instance Method Details

#call(connection) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/pakyow/application/actions/assets/process.rb', line 13

def call(connection)
  if connection.app.config.assets.process
    # TODO: can we short circuit if the request path doesn't match the connection?
    if asset = find_asset(connection) || find_pack(connection) || find_asset_map(connection) || find_pack_map(connection)
      connection.set_header("content-type", asset.mime_type)
      connection.body = asset
      connection.halt
    end
  end
end