I just realized that this might work:
irb(main):073:0> (1.public_methods - Object.public_methods).sort
=> ["%", "&", "*", "**", "+", "+@", "-", "-@", "/", "<<", ">>", "[]",
"^", "_orig_div", "_orig_mul", "abs", "angle", "arg", "between?",
"ceil", "chr", "coerce", "conj", "conjugate", "denominator", "div",
"divmod", "downto", "even?", "fdiv", "floor", "gcd", "id2name", "im",
"imag", "image", "integer?", "lcm", "modulo", "next", "nonzero?",
"numerator", "odd?", "ord", "polar", "prec", "prec_f", "prec_i", "pred",
"quo", "real", "remainder", "round", "singleton_method_added", "size",
"step", "succ", "times", "to_f", "to_i", "to_int", "to_sym", "truncate",
"upto", "zero?", "|", "~"]
So if you do 1.public_methods it shows you instance methods because 1 is
an instance of the class Integer. If you do Integer, this is just the
class so it will only look at class methods.
Is this the best way to get the list of unique methods for Integer,
including instance methods?
--
Posted via http://www.ruby-forum.com/.