As you can see, it magically gives us the dual interface for the methods beneath it. You can also affect specific methods by name, just as you could with private(). This is equivalent to my definition above:

moduleGreeterdefhello"Hello!"endmodule_function:helloend

What this helper actually does is to make a copy of the method and move it up to the module interface level. Once the copy is made, they can be affected separately:

This process also marks the instance method version private(), which is why I needed the call to public() in the last example. This means that methods you mixin to another object do not add to its external interface:

About

James Edward Gray II was a part the Ruby community before Rails
ever shipped. He wrote code and documentation that now come with
the language. He ran two Red Dirt Ruby Conferences and is now
a regular on the Ruby Rogues podcast. He does all of this just
because he loves to program. This site is where he writes about
that.