lib/rasem/application.rb in rasem-0.5.6 vs lib/rasem/application.rb in rasem-0.6.0
- old
+ new
@@ -16,10 +16,16 @@
svg_file = source_file.sub(/\.rasem$/, '.svg')
else
svg_file = source_file + ".svg"
end
img = Rasem::SVGImage.new("100%", "100%") do
- eval(File.read(source_file), binding)
+ begin
+ load File.expand_path(source_file)
+ rescue Exception => e
+ # Keep the portion of stack trace that belongs to the .rasem file
+ backtrace = e.backtrace.grep(Regexp.new(File.expand_path(source_file)))
+ raise e.class, e.message, backtrace
+ end
end
File.open(svg_file, "w") do |f|
f << img.output
end
end