opal/opal

An inconsistency with requiring in MRI vs. Opal

Open

#778 opened on 2015年3月26日

GitHub で見る
 (7 comments) (0 reactions) (0 assignees)Ruby (4,766 stars) (382 forks)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.

コントリビューターガイド