def ensure_module_defined(module_name)
module_name.split('::').reduce(Object) do |last_module, next_module|
- last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module)
- last_module.const_get(next_module)
+ last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false)
+ last_module.const_get(next_module, false)
end
end