[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Trouble with mod_eval

gusmayo

7/8/2006 12:02:00 AM

I have installed Ruby upon OS X recently and I am working on a small
script just to test out some new techniques and trying to learn some
new languages. Currently I am trying to work out a little code to
develop new methods on the fly. I have read about mod_eval, and trying
to use:

self.mode_eval(mod)

Where mod is a variable method. Unfortunately I can not seem to get it
right, every exceution I try results in:

undefined method `mod_eval' for #<Bot:0x328258>

Where #<Bot:0x328258> is the class that is calling mod_eval(). I have
looked for documentation on this but I can not seem to find anything.
So any help would be greatly appreciated.

Am I missing something small that I should be requiring, or am I
missing the whole idea completely?

Thanks.

1 Answer

Sean O'Halpin

7/8/2006 1:29:00 AM

0

On 7/8/06, gusmayo@gmail.com <gusmayo@gmail.com> wrote:
> I have installed Ruby upon OS X recently and I am working on a small
> script just to test out some new techniques and trying to learn some
> new languages. Currently I am trying to work out a little code to
> develop new methods on the fly. I have read about mod_eval, and trying
> to use:
>
> self.mode_eval(mod)
>
> Where mod is a variable method. Unfortunately I can not seem to get it
> right, every exceution I try results in:
>
> undefined method `mod_eval' for #<Bot:0x328258>

This is a clue. See below.

>
> Where #<Bot:0x328258> is the class that is calling mod_eval(). I have
> looked for documentation on this but I can not seem to find anything.
> So any help would be greatly appreciated.
>
> Am I missing something small that I should be requiring, or am I
> missing the whole idea completely?
>
> Thanks.

Well, there's a couple of things here:

1) There is no method that I know of in Ruby called 'mod_eval' (or
'mode_eval'). Perhaps you mean 'module_eval'.

2) 'module_eval' only works in the context of a Module or Class definition.

HTH

Regards,
Sean