Class: Rail::Precompiler
- Inherits:
-
Object
- Object
- Rail::Precompiler
- Defined in:
- lib/rail/precompiler.rb
Defined Under Namespace
Classes: Storage
Instance Method Summary collapse
-
#initialize(pipeline, storage = nil) ⇒ Precompiler
constructor
A new instance of Precompiler.
- #process(paths) ⇒ Object
Constructor Details
#initialize(pipeline, storage = nil) ⇒ Precompiler
Returns a new instance of Precompiler.
23 24 25 26 |
# File 'lib/rail/precompiler.rb', line 23 def initialize(pipeline, storage = nil) @pipeline = pipeline @storage = storage || Storage.new end |
Instance Method Details
#process(paths) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rail/precompiler.rb', line 28 def process(paths) if paths.empty? report('Nothing to precompile.') return end report('Precompiling assets...') paths.each_with_index do |path, i| report('%4d. %s' % [i + 1, path]) storage.write(path, read(path)) end report('Done.') end |