J
John Gearhart
I'm new to ruby, so this may be simple, but I can not figure it out.
Simply, I am wanting to dynamically create objects at runtime with a
variable name also given at runtime.
for example -
keys = []
word = ""
while word != "end"
word = (gets.chomp)
word = word.downcase
keys.push(word) unless word == "end"
end
class Word
end
keys.each { |new_obj| new_obj = Word.obj
[user input of win]
puts win.inspect
I know it may sound strange, but I am just playing. Any help would be
greatly appreciated.
-M
Simply, I am wanting to dynamically create objects at runtime with a
variable name also given at runtime.
for example -
keys = []
word = ""
while word != "end"
word = (gets.chomp)
word = word.downcase
keys.push(word) unless word == "end"
end
class Word
end
keys.each { |new_obj| new_obj = Word.obj
[user input of win]
puts win.inspect
I know it may sound strange, but I am just playing. Any help would be
greatly appreciated.
-M