Class: Opal::BuilderProcessors::RubyERBProcessor

Inherits:
RubyProcessor show all
Defined in:
opal/lib/opal/builder_processors.rb

Overview

This handler is for files named ".rb.erb", which ought to first get preprocessed via ERB, then via Opal.

Instance Attribute Summary

Attributes inherited from Processor

#abs_path, #autoloads, #filename, #options, #required_trees, #requires, #source

Instance Method Summary collapse

Methods inherited from RubyProcessor

#autoloads, #cache_key, #compiler_for, match?, #required_trees, #requires, #source, #source_map

Methods inherited from Processor

handles, #initialize, #mark_as_required, match?, match_regexp, #to_s

Constructor Details

This class inherits a constructor from Opal::BuilderProcessors::Processor

Instance Method Details

#compiledObject



149
150
151
152
153
154
155
156
157
158
159
160
# File 'opal/lib/opal/builder_processors.rb', line 149

def compiled
  @compiled ||= begin
    erb = ::ERB.new(@source.to_s)
    erb.filename = @abs_path

    @source = erb.result

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