C
Cd Cd
I have the following
#!/usr/bin/ruby -w
require 'net/http'
h=Net::HTTP.new('www.pragmaticprogrammer.com',80)
response=h.get('/index.html',nil)
if(response.message=="OK")
puts response.body.scan(/<img src="(.*?)"/m).uniq
end
I know you can add methods to an existing class, but in the above code,
there is the following:
puts response.body.scan(/<img src="(.*?)"/m).uniq
I don't get how the methods are being added to the class in this case.
Is uniq() being added to scan(), the being added to body() which in turn
is added to the response object?
#!/usr/bin/ruby -w
require 'net/http'
h=Net::HTTP.new('www.pragmaticprogrammer.com',80)
response=h.get('/index.html',nil)
if(response.message=="OK")
puts response.body.scan(/<img src="(.*?)"/m).uniq
end
I know you can add methods to an existing class, but in the above code,
there is the following:
puts response.body.scan(/<img src="(.*?)"/m).uniq
I don't get how the methods are being added to the class in this case.
Is uniq() being added to scan(), the being added to body() which in turn
is added to the response object?