3 ways to do the same? (Modules)

Hi. Take the following code, best save it locally in your editor:

module Test1

  def test1
    puts "Hello from Test1"
  end

  extend self

end

module Test2

  module_function

  def test2
    puts "Hello from Test2"
  end

end

module Test3
  class << self
    def test3
      puts "Hello from Test3"
    end
  end
end

class TestObject

  include Test1
  include Test2
  include Test3

end

Test1.test1
Test2.test2
Test3.test3

# ------------------------

The output is the same in all cases. I understand that when using this
in a class, there is a difference between private and non-private calls.

But my question has not to do with inheritance. Instead, do these 3
things the same as far as a module is concerned, if you would only use
it as a standalone-module?

Right now it seems as if all 3 things do the same and I am confused why
we have 3 ways...

···

--
Posted via http://www.ruby-forum.com/.