Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Create And Set Instance Variables From Method Parameters / Arguments

DZone's Guide to

Create And Set Instance Variables From Method Parameters / Arguments

·
Free Resource
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.

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

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}