lib/usable.rb in usable-3.9.2 vs lib/usable.rb in usable-3.9.3
- old
+ new
@@ -126,10 +126,11 @@
extension_method = options.delete(:method)
args.each do |mod|
ModExtender.new(mod, only: only, method: extension_method).call self
# Define settings on @usables and on the scoped @usables
scope = Config.new
- if mod.name
+ # Nest the new config under a namespace based on it's name, unless it's the default name we gave
+ if mod.name && !mod.name.include?("UsableMod")
scope_name = mod.name.split('::').last.gsub(/\B([A-Z])([a-z_0-9])/, '_\1\2').downcase
usables[scope_name] = scope
end
if mod.respond_to? :usables
scope += mod.usables