how to name an object reference (handle) dynamically in ruby
Posted
by RetroNoodle
on Stack Overflow
See other posts from Stack Overflow
or by RetroNoodle
Published on 2010-06-06T21:52:42Z
Indexed on
2010/06/06
22:02 UTC
Read the original article
Hit count: 285
So I have a class like this:
def Word
end
and im looping thru an array like this
array.each do |value|
end
And inside that loop I want to instantiate an object, with a handle of the var
value = Word.new
Im sure there is an easy way to do this - I just dont know what it is!
Thanks!
© Stack Overflow or respective owner