Forum: Ruby Net::HTTP.get(...) not working (still)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
michelle (Guest)
on 2005-11-21 09:43
(Received via mailing list)
Now that I've got my DNS back, I'm still getting the same basic error I
had last time around, complaining: undefined method 'line'

Help?

---

def fromWeb(site, url)
	# get data from website
	h = Net::HTTP.new(site, 80)
	resp=h.get(url) do
		# process data
		|line|
		if /DGM_navigation/ =~ line do
			# decode page lineage
			step=Array.new
			astep, line = getNextWord(line)
			while astep != nil
				step.push(astep)
				astep, line = getNextWord(line)
			end
			puts "Page Lineage"
			indent = 0
			step.each do
				|astep|
				indent.each do
					put " "
				end
				puts astep
				indent += 1
			end
		end # end DGM_naviation
	end # end Net::HTTP.get
end # end def fromWeb
logancapaldo (Guest)
on 2005-11-21 16:31
(Received via mailing list)
On 11/21/05, Lady Michelle B. <removed_email_address@domain.invalid> wrote:
> h = Net::HTTP.new(site, 80)
> end
> end # end DGM_naviation
> end # end Net::HTTP.get
> end # end def fromWeb
>
>
Minor syntax error on your part

if's syntax is
if cond
...
end

not

if cond do # calls cond with the block
...
end
This topic is locked and can not be replied to.