class Propshaft::Assembly

Attributes

config[R]

Public Class Methods

new(config) click to toggle source
# File lib/propshaft/assembly.rb, line 13
def initialize(config)
  @config = config
end

Public Instance Methods

compilers() click to toggle source
# File lib/propshaft/assembly.rb, line 38
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
load_path() click to toggle source
# File lib/propshaft/assembly.rb, line 17
def load_path
  @load_path ||= Propshaft::LoadPath.new(config.paths, version: config.version)
end
processor() click to toggle source
# File lib/propshaft/assembly.rb, line 33
def processor
  Propshaft::Processor.new \
    load_path: load_path, output_path: config.output_path, compilers: compilers
end
resolver() click to toggle source
# File lib/propshaft/assembly.rb, line 21
def resolver
  @resolver ||= if manifest_path.exist?
    Propshaft::Resolver::Static.new manifest_path: manifest_path, prefix: config.prefix
  else
    Propshaft::Resolver::Dynamic.new load_path: load_path, prefix: config.prefix
  end
end
reveal(path_type = :logical_path) click to toggle source
# File lib/propshaft/assembly.rb, line 47
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
server() click to toggle source
# File lib/propshaft/assembly.rb, line 29
def server
  Propshaft::Server.new(self)
end

Private Instance Methods

manifest_path() click to toggle source
# File lib/propshaft/assembly.rb, line 56
def manifest_path
  config.output_path.join(Propshaft::Processor::MANIFEST_FILENAME)
end