ptkwt
1/15/2006 10:11:00 PM
In article <ad9751290601151338k1384454fj64b900831961a4f6@mail.gmail.com>,
Alex Polite <notmyprivateemail@gmail.com> wrote:
>I'm just starting out with ruby.
>
>I'm trying to make an array of arrays containing [a pattern, a string,
>a function]
>
>Patterns and strings went fine but when I put in a function ruby tries
>to eval it and complains about not getting right number of arguments.
>
>Is there any way to escape a method so that you can put it in a list
>or pass it as an argument to another function?
>
>pats =3D [
> [/:BEGIN:(.*)/, "DTSTART", Df.datestr2time ],
> [/:DUE:(.*)/, "DUE", Df.datestr2time]
> ]
>
How about:
pats = [
[/:BEGIN:(.*)/, "DRSTART", Df.method(:datestr2time)],
[/:DUE:(.*)/, "DUE", Df.method(:datestr2time)]
]
Phil