If by "correct" you mean syntactically correct - yes .
There is nothing wrong with that, and if you define a subclass in a separate file (example below), then this is a relatively common practice.
# lib/foo.rb module Foo end
I would not define classes this way if you cannot be sure that the parent module or class already exists, since you will get a NameError due to the lack of a parent (e.g. Foo ). For this reason, you will not see a lot of open source software that follows a shorter template.
Separately, this will not work:
class Foo::Bar end
This, however, will work:
module Foo class Bar end end
source share