Is there a way to use class method in a module without extend it in rails?

Viewed 1254

currently I have a module like this:

module MyModule
  def A

  end

  .....

end

and I have a model that I want to use that method A as a class method. However, the thing is I only need that A method. If I extend it, I am gonna extend the other unnecessary class methods into my model. Therefore, is there a way for me to do sth like MyModule.A without rewriting the module like this:

module MyModule
  def A
    ...
  end

  def self.A
    ...
  end

  .....

end

It is kind of repeating myself if I do it that way. I still feel there is a better way to do it in Rails.

2 Answers
Related