Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v2.3.8) is shown here.
These similar methods exist in v7.1.3.2:
class_collisions(*class_names)
public
Check whether the given class names are already taken by Ruby or Rails. In the future, expand to check other
namespaces such as the rest of the user’s app.
Show source
def class_collisions(*class_names)
path = class_names.shift
class_names.flatten.each do |class_name|
class_name = class_name.to_s
next if class_name.strip.empty?
nesting = class_name.split('::')
name = nesting.pop
extra = []
extra << false unless Object.method(:const_defined?).arity == 1
last = nesting.inject(Object) { |last, nest|
break unless last.const_defined?(nest, *extra)
last.const_get(nest)
}
if last and last.const_defined?(name.camelize, *extra)
raise_class_collision(class_name)
end
end
end