You are taking the operator precedence wrong. It means
class << (PushableModule = Module::new)
...
end
It creates a module by Module::new
, then names it as PushableModule
, then opens its eigenclass by <<
.
It is overwriting the constructor of PushableModule
. Since new
should be defined as PushableModule.new
, not as an instance method, the definition is done within the eigenclass.
Usually, you don't overwrite new
, but define an instance method initialize
, but in some special occasions, the new
constructor can be rewritten.