actually its kind of the the opposite, module_function is pretty much unofficially considered deprecated. module_function does 2 things: it makes the module's instance methods as private and also copies them  into the module singleton class. 

for the singleton pattern, extend self is the right idiom that does exactly the right thing, no more, here's how. When you create a module
```ruby
module X
  def x
    "x"
  end
end

o = Object.new
o.extend(X)
o.x #=> "x"
```
X is actually an instance of the class Module, it could be written this way:
```ruby
X = Module.new do
  def x
    "x"
  end
end
```
so at this point, we could do this, right?
```ruby
X.extend(X)
X.x #=> "x"
```

which is the equivalent of
```ruby
module X
  extend X

  def x
    "x"
  end
end
```

and in the end, this is what `extend self` is the shortcut for
```ruby
module X
  extend self

  def x
    "x"
  end
end
```

the nice thing is that knowing that X is an ordinary instance object, it can have instance variables. 

```ruby
module X
  extend self

  def x
    @x ||= 0
    @x += 1
  end
end
X.x #=> 1
X.x #=> 2
```

but since its not a class it cannot be instantiated.
```ruby
X.new #=> NoMethodError: undefined method `new' for X:Module
```