From: "Berge, Robert" Date: 2002-09-19T07:15:51+09:00 Subject: Possible bug with handling of default values for a method This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C25F60.EFBD1280 Content-Type: text/plain I have the following code snippet: class SomeClass def meth1( to = 'default1', msg = 'default2' ) ... end end param1 = nil ## value is nil because of selecting from a nullable db field param2 = "Some Message" sc.meth1( param1, param2 ) The to variable is nil inside meth1, it is not getting assigned the default value. Is this is a bug in how ruby handles default values? Or is there something I have wrong in my code? Any ideas? ------_=_NextPart_001_01C25F60.EFBD1280 Content-Type: text/html Content-Transfer-Encoding: quoted-printable

I have the following code = snippet:

 

class<= font size=3D2 face=3DArial> = SomeClass

     def meth1( to =3D 'default1', msg =3D = 'default2' )

        = ...

     end

end

 

param1 =3D nil ## value is nil because of selecting = from a nullable db field

param2 =3D "Some Message" =

 

sc.meth1(  param1, param2 = )

 

 

The = to variable is nil inside meth1, it is not getting assigned the default value.  Is this is a bug in how ruby = handles default values?  Or is = there something I have wrong in my code?  Any ideas?

------_=_NextPart_001_01C25F60.EFBD1280--