I love Ruby. Here's one of a thousand reasons why:
song.__send__ "#{msg}=", token
The value of msg is the name of an attribute, so this code sets that attribute (well, calls the method attribute= where attribute is the attribute name, where an attr_accessor or attr_writer exists) to the value of token.
That's equivalent to calling song.foo = token if msg has the value foo.
Technorati Tags: languages, programming, ruby



