Are there any reserved class names inside the module?
Are there reserved class names within the module ?
module MyLibrary
class Class
end
class Object
end
class Banana < Object
end
end
Ruby doesn't seem to get confused.
MyLibrary::Object.new.is_a?(::Object)
#=> true
MyLibrary::Class.new.class
#=> MyLibrary::Class
MyLibrary::Class.class
#=> Class
MyLibrary::Banana.new.is_a?(::Object)
#=> true
MyLibrary::Banana.new.is_a?(MyLibrary::Object)
#=> true
MyLibrary::Banana.ancestors
#=> [MyLibrary::Banana, MyLibrary::Object, Object, Kernel, BasicObject]
+3
source to share
1 answer
Just ruby reserved words like BEGIN and END. In fact, they may be the only ones.
http://docs.ruby-lang.org/en/2.2.0/keywords_rdoc.html
Just like FYI, Rails has a separate list of reserved words.
+4
source to share