Class: Propshaft::Assembly

Inherits:
Object
  • Object
show all
Defined in:
lib/propshaft/assembly.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Assembly

Returns a new instance of Assembly.



12
13
14
# File 'lib/propshaft/assembly.rb', line 12

def initialize(config)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



10
11
12
# File 'lib/propshaft/assembly.rb', line 10

def config
  @config
end

Instance Method Details

#compilersObject



37
38
39
40
41
42
43
44
# File 'lib/propshaft/assembly.rb', line 37

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_pathObject



16
17
18
# File 'lib/propshaft/assembly.rb', line 16

def load_path
  Propshaft::LoadPath.new(config.paths)
end

#processorObject



32
33
34
35
# File 'lib/propshaft/assembly.rb', line 32

def processor
  Propshaft::Processor.new \
    load_path: load_path, output_path: config.output_path, compilers: compilers
end

#resolverObject



20
21
22
23
24
25
26
# File 'lib/propshaft/assembly.rb', line 20

def 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

#serverObject



28
29
30
# File 'lib/propshaft/assembly.rb', line 28

def server
  Propshaft::Server.new(self)
end