Guest User

Untitled

a guest
Jun 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. class Test
  2. attr_accessor :actor , :hobby , :colour , :weekday
  3. end
  4.  
  5. list_of_commands = {:actor => 'Will Smith' , :hobby => 'porn :P' , :colour => 'black' , :weekday => 'Wednesday' }
  6. x = Test.new
  7.  
  8. list_of_commands.each do |method_name , value|
  9. x.send( method_name.to_s + '=' , value )
  10. puts x.send(method_name)
  11. end
  12.  
  13. puts x.inspect
Add Comment
Please, Sign In to add comment