you are just assigning a to an array literal
This is equivalent to
a = Array.new([‘one’,‘two’,‘three’])
Like Siep said, array access a[0] will raise the error.
r
----- Original Message ----
From: Siep K. [email protected]
To: ruby-talk ML [email protected]
Sent: Thursday, May 29, 2008 3:28:45 PM
Subject: Re: Quickie: Monkey patching Array
Leon B. wrote:
Didn’t work also. It just prints: [“one”, “two”, “three”]
try
p a[0]
[] is just a method. You chanced it. To verify if your change works, you
'll have to use the [] method. If this is not what you want, what
outcome did you expect?
regards,
Siep