I’m experimenting with Anemone, a ruby web spider framework. I want to know how do I print all methods associated with an object? For example, the code below outputs puts page.url but I want to know what other methods are available, other than url. How do I print out all associated methods?
require 'anemone'
Anemone.crawl("http://www.fsu.edu") do |anemone|
anemone.on_every_page do |page|
puts page.url
end
end
Answer puts (page.methods - Object.public_methods)
I’ve used this to sort out the uninteresting things:
Also, from the IRB I use the Wirble gem which has
poandpocmethods that do something similar:Update: These days I use Pry. When Pry is available, the
lscommand works great: