Here you combine several concepts that are not really related, namely: the boot path, inheritance, and the region resolution operator.
When requesting (or downloading) files, the argument of the require keyword is simply taken as the path to the file and added to the download search path (the .rb extension is optional for require ). Inheritance and nesting don't come into play here, and any file can define everything it wants, for example:
require 'foo'
Nested classes (and modules, variables, etc.) are defined as expected, but are resolved using the scope resolution operator, for example:
class Foo def foo; 'foo'; end class Bar def bar; 'bar'; end end end Foo.new.foo
Note that nesting and inheriting classes are not related to the location of the file from which they are loaded. It seems that there are no explicit conventions for structuring classes and modules, so you can do what works for you. The Ruby Language page of the Ruby programming page can also be useful.
source share