#!/usr/bin/env ruby # This code comes from http://ruby-it.org/pages/Reflection # Check the page for copyright notice and explanations >> puts 5.class Fixnum >> 5.class.superclass >> Integer >> 5.class.superclass.superclass => Numeric >> 5.class.superclass.superclass.superclass => Object >> puts 5.methods.sort % & * ** + >> class C >> def met >> end >> end => nil >> C.new.public_methods => ["dup", "hash", "private_methods", "nil?", "tainted?", "class", "singleton_me thods", "=~", "__send__", "untaint", "instance_eval", "extend", "kind_of?", "obj ect_id", "instance_variable_get", "inspect", "frozen?", "taint", "id", "public_m ethods", "respond_to?", "equal?", "to_a", "clone", "method", "protected_methods" , "freeze", "instance_variable_set", "type", "is_a?", "methods", "==", "send", " met", "instance_of?", "===", "instance_variables", "__id__", "eql?", "to_s", "di splay"] >> C.new.public_methods false => ["met"]