using IRB in your scripts
In ruby there’s a tool called IRB.. I like IRB. I like IRB a lot.. I love IRB!
IRB is a tool which lets you execute ruby expressions read from stdin. I use it a lot to inspect elements I get returned from a SOAP or XMLRPC interface, to see how to use them. Some times, however, I can’t get such an element easily, because it’s nested inside a script. The solution to this is invoking irb from within your script.
require 'irb' @api = Api.call('foo') @api.results.each do |result| @result = result IRB.start end
This will spawn an IRB shell for each result from the api, which will have @api and @result at its disposal to inspect and use.
0 comments