Skip to content

Instantly share code, notes, and snippets.

@SamGerber-zz
Created December 9, 2015 05:44
Show Gist options
  • Save SamGerber-zz/2d1277604d1bd2def9d4 to your computer and use it in GitHub Desktop.
Save SamGerber-zz/2d1277604d1bd2def9d4 to your computer and use it in GitHub Desktop.
Setting Instance Variables Explicitly Within the Class
class Universe
def initialize
@answer = "42"
end
end
universe = Universe.new # => #<Universe:0x007f4b34292288 @answer="42">
universe.instance_variables # => [:@answer]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment