Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Test
- attr_accessor :actor , :hobby , :colour , :weekday
- end
- list_of_commands = {:actor => 'Will Smith' , :hobby => 'porn :P' , :colour => 'black' , :weekday => 'Wednesday' }
- x = Test.new
- list_of_commands.each do |method_name , value|
- x.send( method_name.to_s + '=' , value )
- puts x.send(method_name)
- end
- puts x.inspect
Add Comment
Please, Sign In to add comment