Reputation: 693
Is it possible to merge multiple module definitions in a single file and avoid possible clashes with Rails autoloading ?
Thanks !
Upvotes: 2
Views: 1379
Reputation: 121000
I am not sure I understood how this would help “to avoid possible clashes with Rails autoloading”, but the answer is “yes”: one might define as many modules, classes, constants and whatever is defineable in the single file.
Ruby has no restriction on the relation between file names and modules/classes names. One might define modules A1
and A2
in file b.rb
. Standard lib/namespace/class_name.rb
convetion is the convention only, as soon as file is required, it’s content is being loaded.
Upvotes: 1