Skip to content

Instantly share code, notes, and snippets.

@ody
Created August 23, 2012 02:52
Show Gist options
  • Save ody/3431635 to your computer and use it in GitHub Desktop.
Save ody/3431635 to your computer and use it in GitHub Desktop.
Class Foo
attr_accessor :bar
def initialize
@bar = 'new'
end
end
afoo = Foo.new
afoo.bar = 'old'
puts afoo.bar
@barn
Copy link

barn commented Aug 23, 2012

Class Foo

attr_accessor :bar

This is what I'm trying to do, but obviously isn't right.

def initialize( value )
varname = 'bar'
@#{varname} = value
end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment