File: compiler.rb

package info (click to toggle)
ruby-propshaft 1.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 172 kB
  • sloc: ruby: 782; makefile: 4
file content (25 lines) | stat: -rw-r--r-- 529 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

# Base compiler from which other compilers can inherit
class Propshaft::Compiler
  attr_reader :assembly
  delegate :config, :load_path, to: :assembly

  def initialize(assembly)
    @assembly = assembly
  end

  # Override this in a specific compiler
  def compile(asset, input)
    raise NotImplementedError
  end

  def referenced_by(asset)
    Set.new
  end

  private
    def url_prefix
      @url_prefix ||= File.join(config.relative_url_root.to_s, config.prefix.to_s).chomp("/")
    end
end