lib/xkcd.rb in xkcd-0.0.5 vs lib/xkcd.rb in xkcd-0.0.6
- old
+ new
@@ -19,8 +19,11 @@
class << XKCD
alias_method :get, :comic
end
def self.img
- Nokogiri::HTML(open('http://dynamic.xkcd.com/random/comic/')).css('#comic img')[0].attributes["src"].value
+ img = Nokogiri::HTML(open('http://dynamic.xkcd.com/random/comic/')).css('#comic img')[0]
+ img_url = img.attributes["src"].value
+ img_title = img.attributes["title"].value
+ "#{img_title} : #{img_url}"
end
end