Trouble with mod_eval

G

gusmayo

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.
 
S

Sean O'Halpin

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,813
Messages
2,569,696
Members
45,478
Latest member
dontilydondon

Latest Threads

Top