Lohith MV
Lohith MV

Reputation: 3908

how to list all the methods available for a given object in ruby but not the inbuilt ones

How do i list all the methods of an object in Ruby which are not in-built methods, if I do Fruit.new.methods it will list all the methods which includes user defined methods which are declared in the class Fruit,I want to see only the methods which are written in class Fruit.

Upvotes: 1

Views: 1518

Answers (1)

osahyoun
osahyoun

Reputation: 5231

myFruit.public_methods(false) returns the list of public methods accessible to myFruit with inherited methods excluded.

Upvotes: 3

Related Questions