Try it this way:
In your file include Pry and do a binding.pry
:
require 'nokogiri'
require 'open-uri'
require 'pry'
doc = Nokogiri.XML('<foo><bar /><foo>', nil, 'UTF-8')
url = "http://superbook.eventmarketer.com/category/agencies/"
binding.pry
puts "Finished!"
Then run the file by executing:
ruby AgencyListingScraper.rb
That should drop you into a Pry session where you can use commands like ls
to see all of the variables.
Both the way you used Pry, and this way, work. However, the reason that load
may not be working in your case is that local variables don't get carried over across files, like when you require one file from another.
Try loading this file:
#test.rb
y = "i dont get carried over cause i am a local variable"
b= "i dont get carried over cause i am a local variable"
AAA= "i am a constant so i carry over"
@per = "i am an instance var so i get carried over as well"
When you load it in Pry using load "test.rb"
you can see that you can't get access to the local variables from that file.