That is weird and as I have shown totally worthless. This is likely coming from some autocorrect feature and it should be possible to switch that off.
Try to find that reference. There is no good reason for nesting 3 deep.
And a class is only used when you need to encapsulate state in multiple instances. (The extension submodule can have nested class definitions that are used only by that 1 extension.)
Since an extension is a singleton kind of thing, it need only be a (1) module (which is an instance of class Module
.)
FYI: When you do this in a interpreted rb file:
module SomeName
# constant, variable and method definitions
end
… the interpreter turns it into …
SomeName = Module.new {
# constant, variable and method definitions
}