Archive for August 3rd, 2007
Friday, August 3rd, 2007
Beautiful Ruby: Learning the -isms
I did PHP for 6 years.... sometimes its hard not to do PHP in ruby...
Today i was testing a url to see if it contains a certain string:
PLAIN TEXT
RUBY:
response = Net::HTTP.get_response(URI.parse("http://myawesomesite")
if response.body.match("my awesome text") == nil then
return false
end
and remember to do:
PLAIN TEXT
RUBY:
response = Net::HTTP.get_response(URI.parse("http://myawesomesite")
return "false" if response.body.match("my awesome text").nil?
Another thing [...]
