Thursday, June 21, 2007

Send Method in Ruby

When you have an object, you can set the values for its attributes by:

obj.send(#{attribute}, value) where attribute is the actual attribute while looping through an array of strings that contains the attribute names. The value is the actual value that is used to initialize the attribute.

No comments:

Post a Comment