In Ruby, I see that it can be useful to put classes inside modules for the sake of namespacing. I also see that it\'s possible to put modules inside classes. But I don\'t see wh
I guess it’s really just about using a class as a namespace, which is sometimes just more convenient that putting everything in a module. I’ve never seen that in practice, but it’s perfectly valid Ruby code either way.
The only real-life scenario I can think of is using EventMachine in a class:
class Api
def initialize
EM.start_server "0.0.0.0", 8080, Server
end
module Server
def receive_data (data)
# do stuff
end
end
end