Skip to content

Instantly share code, notes, and snippets.

@xpepper
Created April 4, 2012 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xpepper/2305942 to your computer and use it in GitHub Desktop.
Save xpepper/2305942 to your computer and use it in GitHub Desktop.
How do you tell if a Ruby object is a class?
class Object
def is_a_class?
respond_to? :superclass
end
end
class MyClass
end
puts "hi there!".is_a_class? # => false
puts MyClass.is_a_class? # => true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment