Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8254151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:06:03+00:00 2026-06-08T01:06:03+00:00

Is it ruby convention for all files to be in a module with the

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:06:05+00:00Added an answer on June 8, 2026 at 1:06 am

    It’s generally a good idea to put classes and files in a structure like that, because it will make it easier for people to map the name of the class to its definition.

    But it can make sense not to do this (ultimately you structure your code however you like). I’ve occasionally done it when there were lots of small classes all dealing with the same thing, I put them together.

    And it can make sense to have a file which does not define a module or class, e.g. a configuration file, or a binary, or a bootstrapping file (file which loads up all the other ones).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 3 servers with processes that require all the CPU they can get.
I am running Ruby on Rails 3 and I have an application that makes
I have a site that needs to encrypt and store binary files that are
I'm writing a program in Ruby that downloads a file from an RSS feed
As per Ruby on Rails convention, controller names get pluralized while model names are
I've got a ruby script that opens a connection to Apple's push server and
Is there a ruby gem or such for MySQL connection pooling that isn't part
I have code to run sql query in ruby as follows sql = ActiveRecord::Base.connection()
Ruby has a select method that takes an array and returns a subarray consisting
I am on rails 2.3.5 and have the latest Ruby installed and my application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.