Adventures in Software Engineering
Sunday, March 27, 2011
Create Class Dynamically in Ruby
Sample
def create_class_dynamically(mybinding)
clazz = 'class MyClass; end'
Kernel.eval(clazz, mybinding)
end
create_class_dynamically(binding)
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment