Date: Fri, 1 Jan 2010 20:11:52 -0700 From: James Harrison <oscartheduck@gmail.com> To: ruby@freebsd.org Subject: portupgrade code question Message-ID: <70626630-CEF2-40DA-853E-82FBE5CB9487@gmail.com>
next in thread | raw e-mail | index | archive | help
Hey folks,
I've been reading the code for portupgrade and have come across something I don't understand at all.
In the lib/portsdb.rb, the glob method starts on line 757.
On line 773, as part of the glob method, we have the following:
<---snip--->
# shortcut
if portinfo = port(pattern)
if block_given?
yield(portinfo)
return nil
else
return [portinfo]
end
end
end
<---/snip--->
Won't the condition "if portinfo = port(pattern)" always evaluate to true, as it's an assignation not a test? Is it meant to read if portinfo == port(pattern)?
If so, there are then a fair few tests which use = instead of ==
If not, what's the purpose?
Thanks!
James
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?70626630-CEF2-40DA-853E-82FBE5CB9487>
