Module: RackPipeline::Processing
- Included in:
- Base
- Defined in:
- lib/rack-pipeline/processing.rb
Instance Method Summary collapse
- #combine(sources, target) ⇒ Object
- #combine? ⇒ Boolean
- #compile(source, target) ⇒ Object
- #compress(source, target) ⇒ Object
Instance Method Details
#combine(sources, target) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/rack-pipeline/processing.rb', line 9 def combine(sources, target) cache_target(sources, target) do |target_path| body = sources.inject('') do |all,(source,kind)| all << File.read(get_or_compile(source, static_type(target))).encode('utf-8') + "\n\n" end File.write(target_path, body) target_path end end |
#combine? ⇒ Boolean
5 6 7 |
# File 'lib/rack-pipeline/processing.rb', line 5 def combine? settings[:combine] end |
#compile(source, target) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/rack-pipeline/processing.rb', line 26 def compile(source, target) fail LoadError, "no compiler for #{source} => #{target}" unless defined?(Compiler) cache_target(source, target) do |target_path| Compiler.process(source, target_path) end end |
#compress(source, target) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/rack-pipeline/processing.rb', line 19 def compress(source, target) return source unless settings[:compress] && defined?(Compressor) cache_target(source, target) do |target_path| Compressor.process(source, target_path) end end |