Is there anyway to get all the class with their instance methods names to be available and to see them in the IRB terminal itself? I am using Nokogiri and Selenium- web driver. If not found "Google" is the only option I know :) Thanks
Is there anyway to get all the class with their instance methods names to be available and to see th
on 2013-02-05 22:45
Re: Is there anyway to get all the class with their instance methods names to be available and to se
on 2013-02-05 22:59
oO have you ever seen Class.instance_methods ? or ObjectSpace.each_object(Class) it looks that you are not even tryed to "google"
Re: Is there anyway to get all the class with their instance methods names to be available and to se
on 2013-02-05 23:01
Hans Mackowiak wrote in post #1095417: > oO have you ever seen Class.instance_methods ? > > or ObjectSpace.each_object(Class) > > > it looks that you are not even tryed to "google" It seems you didn't get my questions. Thanks
Re: Is there anyway to get all the class with their instance methods names to be available and to se
on 2013-02-05 23:15
On 02/05/2013 01:46 PM, Love U Ruby wrote: > Is there anyway to get all the class with their instance methods names > to be available and to see them in the IRB terminal itself? > > I am using Nokogiri and Selenium- web driver. > > If not found "Google" is the only option I know :) > > Thanks > You mean print out all the classes and their instance methods? This should work: ObjectSpace.each_object do |o| if o.is_a? Class puts "Class: #{o}" puts o.instance_methods.sort.inspect end end This doesn't include modules, though... -Justin
Re: Is there anyway to get all the class with their instance methods names to be available and to se
on 2013-02-05 23:18
Justin Collins wrote in post #1095419: > On 02/05/2013 01:46 PM, Love U Ruby wrote: > This should work: > > ObjectSpace.each_object do |o| > if o.is_a? Class > puts "Class: #{o}" > puts o.instance_methods.sort.inspect > end > end > > This doesn't include modules, though... > > -Justin Yes, you are right. But does it give me the Ruby gem methods also. In my case it is nokogiri and selenium webdriver?
Re: Is there anyway to get all the class with their instance methods names to be available and to se
on 2013-02-05 23:29
run gem server in your shell, then access localhost:8880 pick the gem: for sample "nokogiri 1.5.6 [rdoc]" klick on [rdoc] and you get an list of classes and methods this one gem installs inside irb its more comlicated you could try: l = ObjectSpace.each_object(Class).to_a require "nokogiri" ObjectSpace.each_object(Class).to_a - l but it also show classes required by nokogiri you still react like some that is to lazy to google .. (and this is not your first thread where it looks like that)
Re: Is there anyway to get all the class with their instance methods names to be available and to se
on 2013-02-05 23:57
I guess I don't understand why you (Love U Ruby) want to go through so much trouble to avoid going and looking at the documentation for the gems. Although, given that so many of of your posts (Even when you had your old name of "Arup Rakshit") have suggested that other people do the reading for you, I guess it makes sense. The code provided by Justin Collins would give you all of the methods for instances of the current Objects that are in memory (in that instance of the ruby vm). This should give you what you're looking for, even for the Gems (assuming the object you're working with/looking for has been instantiated). I'm still 100% sure that you will have better luck looking at the documentation for the gems, they will be more complete and help you better than just looking at output in irb. -Ryan
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.