I have to parse only the 'current temperature' value in a webpage and display it. Kindly help m开发者_如何学Ce out please.
I highly recommend you using Nokogiri. Here's a good overview.
require 'open-uri'
data =''
open("http://some.site/page/address") do |f| // adjust URI here
data << f.read while !f.eof?
end
temp = data[/current temperature: [0-9]+/] // and regex here
p temp
精彩评论