lib/xkcd.rb in xkcd-0.0.2 vs lib/xkcd.rb in xkcd-0.0.3

- old
+ new

@@ -1,9 +1,18 @@ #!/usr/bin/evn ruby require 'net/http' require 'open-uri' +# The main XKCD driver class XKCD - + # Get img/comic URL from xkcd + # + # Example: + # >> XKCD.img + # => "http://imgs.xkcd.com/comics/hell.png" + # + # >> XKCD.comic + # => "http://xkcd.com/891/" + def self.comic() # This method gets random comic links from xkcd, the uri is the redirected location found in the resp headers uri = URI.parse 'http://dynamic.xkcd.com/random/comic/' req = Net::HTTP::Get.new(uri.request_uri) http = Net::HTTP.new(uri.host)