Trouble with mod_eval

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.

On 7/8/06, [email protected] [email protected] wrote:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs