How do you access an operator/method via a variable?
So instead of this:
c = Computer.new
c.computer_name = "bla"
c.operating_system = "Windows XP"
c.user_name = "joesmith"
c.save
(plus many more)
I want to use a hash and assign the values dynamically:
c = Computer.new
params.each do |key,val|
c."#{key}" = val.to_s
end
c.save
Also, what is the correct terminology here?
One trivial way (not DataMapper-specific, but assumes a
prop_name=method), is to usesend: