lib/opal/builder_processors.rb in opal-1.7.0 vs lib/opal/builder_processors.rb in opal-1.7.1
- old
+ new
@@ -146,12 +146,15 @@
class RubyERBProcessor < RubyProcessor
handles :"rb.erb"
def compiled
@compiled ||= begin
- @source = ::ERB.new(@source.to_s).result
+ erb = ::ERB.new(@source.to_s)
+ erb.filename = @abs_path
+ @source = erb.result
+
compiler = compiler_for(@source, file: @filename)
compiler.compile
compiler
end
end
@@ -161,10 +164,13 @@
# first get preprocessed via ERB, then served verbatim as JS.
class ERBProcessor < Processor
handles :erb
def source
- result = ::ERB.new(@source.to_s).result
+ erb = ::ERB.new(@source.to_s)
+ erb.filename = @abs_path
+
+ result = erb.result
module_name = ::Opal::Compiler.module_name(@filename)
"Opal.modules[#{module_name.inspect}] = function() {#{result}};"
end
end
end