class Propshaft::Assembly
Attributes
Public Class Methods
Source
# File lib/propshaft/assembly.rb, line 15 def initialize(config) @config = config end
Public Instance Methods
Source
# File lib/propshaft/assembly.rb, line 49 def compilers @compilers ||= Propshaft::Compilers.new(self).tap do |compilers| Array(config.compilers).each do |(mime_type, klass)| compilers.register mime_type, klass end end end
Source
# File lib/propshaft/assembly.rb, line 19 def load_path @load_path ||= Propshaft::LoadPath.new( config.paths, compilers: compilers, version: config.version, file_watcher: config.file_watcher, integrity_hash_algorithm: config.integrity_hash_algorithm ) end
Source
# File lib/propshaft/assembly.rb, line 37 def prefix @prefix ||= begin prefix = config.prefix || "/" prefix.end_with?("/") ? prefix : "#{prefix}/" end end
Source
# File lib/propshaft/assembly.rb, line 44 def processor Propshaft::Processor.new \ load_path: load_path, output_path: config.output_path, compilers: compilers, manifest_path: config.manifest_path end
Source
# File lib/propshaft/assembly.rb, line 29 def resolver @resolver ||= if config.manifest_path.exist? Propshaft::Resolver::Static.new manifest_path: config.manifest_path, prefix: config.prefix else Propshaft::Resolver::Dynamic.new load_path: load_path, prefix: config.prefix end end
Source
# File lib/propshaft/assembly.rb, line 58 def reveal(path_type = :logical_path) path_type = path_type.presence_in(%i[ logical_path path ]) || raise(ArgumentError, "Unknown path_type: #{path_type}") load_path.assets.collect do |asset| asset.send(path_type) end end