Ben Nagy
8/10/2006 11:53:00 AM
But one general method of avoiding assignment or restatement is
instance_eval
"this is a test".instance_eval {self[4..self.length]}
ben
> -----Original Message-----
> From: Paul Battley [mailto:pbattley@gmail.com]
> Sent: Thursday, August 10, 2006 6:27 PM
> To: ruby-talk ML
> Subject: Re: Method arguments.
>
> On 10/08/06, Sard Aukary <sardaukary@yahoo.co.uk> wrote:
> > Is there a way to refer to the arguments passed to a
> function, so I can
> > avoid re-stating the argument inside it like the example below?
> >
> > puts "this is a test"[4.."this is a test".length]
>
> In this case, it's unnecessary:
>
> "this is a test"[4..-1]
>
> Paul
>