Skip to content

Instantly share code, notes, and snippets.

@zspencer
Created November 26, 2011 23:16
Show Gist options
  • Save zspencer/1396482 to your computer and use it in GitHub Desktop.
Save zspencer/1396482 to your computer and use it in GitHub Desktop.
Instance variables vs. class instance variables in Ruby
class Foo
@foo = 1
def initialize
@bar = 2
end
end
x = Foo.new
Foo.instance_Variables
x.instance_variables
x.instance_variable_set('@bar', '5678')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment