Sha256: 6003de66e47b37333ec4bd84cc93a362432bb8e58ae45dcfe7a28dbd2f270486

Contents?: true

Size: 813 Bytes

Versions: 2

Compression:

Stored size: 813 Bytes

Contents

# Compatiblity for Opal < 1.6

unless defined? Opal::BuilderProcessors::RubyERBProcessor
  # This handler is for files named ".rb.erb", which ought to
  # first get preprocessed via ERB, then via Opal.
  class Opal::BuilderProcessors::RubyERBProcessor < Opal::BuilderProcessors::RubyProcessor
    handles :"rb.erb"

    def compiled
      @compiled ||= begin
        @source = ::ERB.new(@source.to_s).result
        module_name = ::Opal::Compiler.module_name(@filename)

        compiler = compiler_for(@source, file: @filename)
        compiler.compile
        compiler
      end
    end
  end

  Opal::Builder.processors.sort_by!.with_index do |processor,idx|
    if processor == Opal::BuilderProcessors::RubyERBProcessor
      # Move RubyERBProcessor to the front
      -1
    else
      idx
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opal-browser-0.3.5 spec/browser_runner_compat.rb
opal-browser-0.3.4 spec/browser_runner_compat.rb