Create and set instance variables from method parameters / arguments

/ Published in: Ruby
Save to your folder(s)

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.

Copy this code and paste it in your HTML
  1. local_variables.each { |v| eval("@#{v}=eval(v)") }


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.