Should all ruby files have a module structure that matches the folder structure?

Viewed 6325

Is it ruby convention for all files to be in a module with the folder structure (similar to java packages)?

For example, if I have a file structure that looks like

lib/people/utils

would the files in here have the module structure such as:

module People
  module Utils
    # some functionality for People::Utils
  end
end      

The reason I ask is because I've been reading through some rails code, and there seem to be several files that are in a file structure like this, but don't have any module declarations.

I'm guessing this would be so you could use the utility function without having to include People::Utils.

Is there a convention in ruby as to when modules should be used and when they shouldn't?

2 Answers
Related