As far as I understand, everything in Ruby is an object, and every object has a superclass, except
They're keywords, not classes. If anything, they would be methods in
Kernel, as opposed to classes with superclass
BasicObject, but they're just keywords, and as such have neither class nor superclass. They're a special case and treated specially by the interpreter.
Note that not everything that looks like a keyword is one. Take, for example,
loop do puts 'Hello, world!' end
While it may look like a keyword, it's actually the method
By far the easiest way to tell if something is a method or a keyword is to run this long, complicated code on it:
name_to_test is either a Symbol literal or an instance of Symbol. It uses the always-available method
Object#method, which either returns the
Method with that name or throws a
NameError. If it operates silently -- i.e. doesn't raise any errors -- then you've got a method; if it raises an error, it's not a method. Note that it could also be a variable, not a keyword, but it should be easy enough to tell.
If you want to see the current list of keywords (or don't feel like booting up IRB/your favorite IDE), check this file (CTRL+F
keyword_) in the RMI source. It's a little hard to understand, but basically, if you see
keyword_[thing you're checking] in that list, it's a keyword. To make this answer as self-contained as possible, here's the (current) list of keywords, based on that: