define a class method

B

Benny

dear list,

I know, I can use send( :define_method, "testmeth") to
define an object method (i.e. a singleton method of a class).

but how can I define a "normal" method within the class (that is available
for the objects)

I simply want to define method to which I pass the name and the code for a
new method to created with a certain class


any ideas?


regards benny
 
R

Robert Klemme

Benny said:
dear list,

I know, I can use send( :define_method, "testmeth") to
define an object method (i.e. a singleton method of a class).

but how can I define a "normal" method within the class (that is available
for the objects)

I simply want to define method to which I pass the name and the code for a
new method to created with a certain class


any ideas?


regards benny
NoMethodError: private method `define_method' called for Foo:Class
from (irb):2
Cheers

robert
 

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
474,156
Messages
2,570,878
Members
47,413
Latest member
KeiraLight

Latest Threads

Top