Class: Propshaft::Assembly
- Inherits:
-
Object
- Object
- Propshaft::Assembly
- Defined in:
- lib/propshaft/assembly.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #compilers ⇒ Object
-
#initialize(config) ⇒ Assembly
constructor
A new instance of Assembly.
- #load_path ⇒ Object
- #processor ⇒ Object
- #resolver ⇒ Object
- #reveal(path_type = :logical_path) ⇒ Object
- #server ⇒ Object
Constructor Details
#initialize(config) ⇒ Assembly
Returns a new instance of Assembly.
14 15 16 |
# File 'lib/propshaft/assembly.rb', line 14 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
12 13 14 |
# File 'lib/propshaft/assembly.rb', line 12 def config @config end |
Instance Method Details
#compilers ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/propshaft/assembly.rb', line 39 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 ⇒ Object
18 19 20 |
# File 'lib/propshaft/assembly.rb', line 18 def load_path @load_path ||= Propshaft::LoadPath.new(config.paths, compilers: compilers, version: config.version) end |
#processor ⇒ Object
34 35 36 37 |
# File 'lib/propshaft/assembly.rb', line 34 def processor Propshaft::Processor.new \ load_path: load_path, output_path: config.output_path, compilers: compilers, manifest_path: config.manifest_path end |
#resolver ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/propshaft/assembly.rb', line 22 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 |
#reveal(path_type = :logical_path) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/propshaft/assembly.rb', line 48 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 |