Mass Assignment Lab
Mass Assignment
Objectives
Use keyword arguments to define an initialize method.
Use mass assignment to metaprogram an initialize method.
Instructions
Create a Person class that accepts a hash upon initialization. The keys of the hash should conform to the attributes below:
allowable properties:
Each key in the attributes hash will become a property of an initialized Person instance. So, you should make an
attr_accessor
for each of the above properties
ex:
Your initialize method should use iteration and the
.send
method to mass assign the value of each key/value pair to its associated key (i.e. method). Refer to the previous reading to help you solve this one.
Last updated