Posted By

pmadden on 10/09/09


method variables ruby instance parameters local arguments localvariables

Versions (?)

Create and set instance variables from method parameters / arguments

 / Published in: Ruby


Inserted at the top of the method body, this line creates instance variables for each of the method parameters and sets them to their respective argument values.

  1. local_variables.each { |v| eval("@#{v}=eval(v)") }

Report this snippet  

You need to login to post a comment.