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 8812267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:34:01+00:00 2026-06-14T03:34:01+00:00

I have a class and a module which have the same names: module Pushover

  • 0

I have a class and a module which have the same names:

module Pushover
  def configure
    ..
  end
end

module MyModule
  class Pushover
    def blah
      Pushover.configure
    end
  end
end

This doesn’t work because the Pushover.configure call directs to the containing class. Now, an obvious fix would be to rename the class. However, the Module is from a gem and the class conforms to a naming convention required in a DSL. So ideally they should both stay the same. I could also create a second helper class and call via that, but that all seems a little hacky. My preferred solution would be to directly reference the module method.

All the existing questions around this area seem to be disambiguating in the opposite direction – i.e. they want to get the class reference not the module.

Is there any way for me to inform Ruby that I mean the module rather than the class when I specify Pushover?

  • 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-14T03:34:02+00:00Added an answer on June 14, 2026 at 3:34 am

    If you don’t want to look up the constant relative to the current scope, just use an absolute path:

    ::Pushover.configure
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If you have: module A class B end end You can find B and
I have the following code: class MyClass module MyModule class << self attr_accessor :first_name
I have written a module similar to the following: module One class Two def
I have a ruby file as follows: module Example class Myclass def t_st Hello
I have method that returns module path of given class name def findModulePath(path, className):
I have a class that I want to include in a GWT module. Unfortunately,
I have a class TDevice. Some devices will have a cellular module. So I
I have created a class called Class1, and in another module, I want to
I have a model, Show and a module Utilities class Show < ActiveRecord::Base include
I have a class in my Python module that frobs widgets. It has several

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.