oop/module/self_method.rb

tests/_examples/oop/module/self_method.rb in the metorex repository.

module MyModule
  def self.class_method
    "from module"
  end
end

def MyModule.another_method
  "also from module"
end

puts MyModule.class_method
puts MyModule.another_method

Output:

from module
also from module