ruby - Within a module, are there any reserved class names? -
within module, there reserved class names?
module mylibrary class class end class object end class banana < object end end
ruby doesn't seem 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]
just ruby reserved words begin , end. in fact might two.
http://docs.ruby-lang.org/en/2.2.0/keywords_rdoc.html
just fyi rails has separate list of reserved words.
Comments
Post a Comment