opal/opal

An inconsistency with requiring in MRI vs. Opal

Open

#778 建立於 2015年3月26日

在 GitHub 查看
 (7 留言) (0 反應) (0 負責人)Ruby (4,766 star) (382 fork)batch import
help wantedv1.3

描述

So, I was recently having some problems with require in Opal. In MRI, requiring files works like so: main.rb

require "./file1.rb"
require "./file2.rb"

file1.rb

puts "file1"

file2.rb

puts "file2"

If you run the above code, you'll get file1 and file2 printed out. Also note that if you remove the ./ from the require statements, the above code will not work. But, in Opal (as of 0.7.1), using the ./ syntax does not work and requiring only works without using ./. In Opal 0.6.x, it seems to be that you can require with either ./ or without it. As far as I can tell, this problem seems to be an inconsistency between MRI and Opal.

貢獻者指南