lib/digger/page.rb in digger-0.1.4 vs lib/digger/page.rb in digger-0.1.5

- old
+ new

@@ -93,10 +93,16 @@ @doc ||= begin Nokogiri::HTML(body) if !body.nil? && html? rescue nil end end + def json + @json ||= JSON.parse body + end + def jsonp + @jsonp ||= JSON.parse body.match(/^[^\(]+?\((.+)\)[^\)]*$/)[1] + end # # Discard links, a next call of page.links will return an empty array # def discard_links! \ No newline at end of file