Class: Jagger::Assets
- Inherits:
-
Object
- Object
- Jagger::Assets
- Defined in:
- lib/jagger/assets.rb
Overview
Internal: Assets serves all dynamically generated asssets through sprockets pipeline.
Instance Method Summary collapse
-
#append_paths(dirs = []) ⇒ Object
Public: Registers given load paths in sprockets’ env.
-
#call(env) ⇒ Object
Public: Serves assets.
-
#initialize ⇒ Assets
constructor
Public: Constructor.
Constructor Details
#initialize ⇒ Assets
Public: Constructor. Initializes sprockets environment.
8 9 10 |
# File 'lib/jagger/assets.rb', line 8 def initialize @sprockets = Sprockets::Environment.new end |
Instance Method Details
#append_paths(dirs = []) ⇒ Object
Public: Registers given load paths in sprockets’ env.
dir - The Array of dirs to register
16 17 18 |
# File 'lib/jagger/assets.rb', line 16 def append_paths(dirs = []) dirs.each { |dir| @sprockets.append_path(dir) } end |
#call(env) ⇒ Object
Public: Serves assets
env - The Hash HTTP environment.
Returns HTTP response data.
25 26 27 |
# File 'lib/jagger/assets.rb', line 25 def call(env) @sprockets.call(env) end |