From owner-freebsd-ruby@FreeBSD.ORG Sat Jan 2 03:12:01 2010 Return-Path: Delivered-To: ruby@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE5DB1065694 for ; Sat, 2 Jan 2010 03:12:01 +0000 (UTC) (envelope-from oscartheduck@gmail.com) Received: from mail-gx0-f218.google.com (mail-gx0-f218.google.com [209.85.217.218]) by mx1.freebsd.org (Postfix) with ESMTP id 681048FC13 for ; Sat, 2 Jan 2010 03:12:01 +0000 (UTC) Received: by gxk10 with SMTP id 10so13101358gxk.3 for ; Fri, 01 Jan 2010 19:11:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:content-type :content-transfer-encoding:subject:date:message-id:to:mime-version :x-mailer; bh=XyJkdO6Yw2Cc3XYN0kT3SzGJnmZJILTAFvSz9YCtrvg=; b=NZaoatxm5oT8gqiSAOG5WZUnJRniFjgyM24JpyrHP5gqMWfEKTfdTxWhaGkrHNjbI8 snjuwc8vZ9rnBqqJLo9pgGu8xgTv1zDGs0t+wpqqvis+PkcAFMqYvA3aCY5nEin+1uNE azX6ZDCgL5MG8vgstC9WxpDdAaGOX1Encj/R4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:content-type:content-transfer-encoding:subject:date:message-id :to:mime-version:x-mailer; b=E9jtaDmfFHMhXu/E+y+uWT5wn0uPk5usbSc6MM3oEpD+QJf/fikm/cTVExx3DqlTs+ bjOnO4DeAprM1zjC3p39i0wDcS/qlmyISwqXqG40SH+a/MUEBY0ptURJdzxTBEQEltG5 A388vl3c5Vio44QGS56MnMxEAT6esEOKelfHk= Received: by 10.150.29.40 with SMTP id c40mr4560652ybc.234.1262401916834; Fri, 01 Jan 2010 19:11:56 -0800 (PST) Received: from ?192.168.1.4? (c-71-196-193-228.hsd1.co.comcast.net [71.196.193.228]) by mx.google.com with ESMTPS id 20sm15241826iwn.1.2010.01.01.19.11.54 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 01 Jan 2010 19:11:55 -0800 (PST) From: James Harrison Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Fri, 1 Jan 2010 20:11:52 -0700 Message-Id: <70626630-CEF2-40DA-853E-82FBE5CB9487@gmail.com> To: ruby@freebsd.org Mime-Version: 1.0 (Apple Message framework v1077) X-Mailer: Apple Mail (2.1077) Cc: Subject: portupgrade code question X-BeenThere: freebsd-ruby@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Ruby discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jan 2010 03:12:01 -0000 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 =3D port(pattern) if block_given? yield(portinfo) return nil else return [portinfo] end end end <---/snip---> Won't the condition "if portinfo =3D port(pattern)" always evaluate to = true, as it's an assignation not a test? Is it meant to read if portinfo = =3D=3D port(pattern)? If so, there are then a fair few tests which use =3D instead of =3D=3D If not, what's the purpose? Thanks! James=