From: Marc Heiler Date: 2011-10-17T16:33:01+09:00 Subject: Setting arbitrary objects Hi. For a kind of DSL, I need the following: joker.id = 'koko' garfield.colour = 'green' superman.speed = 55 I think I can solve this with OpenStruct partially. BUT, my problem is: Is there any way to actually make joker, garfield, superman work as is? ALL of these are not known when I run the file! They must be created dynamically. I was thinking I could dynamically create methods like def joker() def garfield() etc... I can find out the name, like so: begin joker.id = 'koko' rescue NameError => error object_name = error.name method_name = ??? exit end This would give me the name "joker" as result and I could dynamically create a method called joker, which could return an OpenStruct. BUT, how do I obtain the information that we wish to set the .id value on that object? -- Posted via http://www.ruby-forum.com/.