Is "required" in Ruby not to include subfolders automatically?

If I have this folder structure:

rexml
rexml/document

Is the following syntax a non-recursive link that includes everything below it?

require 'rexml'

Or do I need to write the following if I also want to access what's in 'document'?:

require 'rexml/document'

The reason I got confused, I see some code in which the author writes that both require approval one by one:

require 'rexml'
require 'rexml/document'

I was not sure if this was really necessary.

+3
source share
2 answers

Ruby require Ruby, - . "require 'rexml", "" rexml.rb " $: ". , "require" rexml/document " " document.rb " " rexml " $:.

+11

Ruby require . /gems , , , - . nokogiri, . , REXML , "rexml/document".

+6

Source: https://habr.com/ru/post/1709886/


All Articles