I'm looking for a elegant way to assign the value stored inside an Hash into a pre-existed object.
Just to be clear, if I have an object, say obj with two attributes, say name and age, I want to assign this values coming from an hash without do something like:
obj.name = hash[:name]
obj.age = hash[:age]
Thanks for your attention.
Simone
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…