J
John Mair
Hello i have the following ruby code, to create class method dynamically
for my module M:
module M
def self.create_method(name, &block)
eigen=class << self; self; end
eigen.module_eval do
define_method(name, &block)
end
end
end
Now i am writing a C extension and need exactly this functionality for
my C version of create_method() how do i do it in C? rb_define_method()
expects a pointer to a C function, but i want to define a new method
that takes a rubyblock instead, so i think rb_define_method() is not the
right route.
Any help would be very much appreciated,
john
for my module M:
module M
def self.create_method(name, &block)
eigen=class << self; self; end
eigen.module_eval do
define_method(name, &block)
end
end
end
Now i am writing a C extension and need exactly this functionality for
my C version of create_method() how do i do it in C? rb_define_method()
expects a pointer to a C function, but i want to define a new method
that takes a rubyblock instead, so i think rb_define_method() is not the
right route.
Any help would be very much appreciated,
john