portupgrade code question
James Harrison
oscartheduck at gmail.com
Sat Jan 2 03:12:01 UTC 2010
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
More information about the freebsd-ruby
mailing list