Skip to content

Instantly share code, notes, and snippets.

@mudge
Created October 28, 2012 10:40
Show Gist options
  • Select an option

  • Save mudge/3968289 to your computer and use it in GitHub Desktop.

Select an option

Save mudge/3968289 to your computer and use it in GitHub Desktop.
Remove instance variables in Ruby.
irb(main):001:0> defined? @foo
=> nil
irb(main):002:0> @foo = "bar"
=> "bar"
irb(main):003:0> defined? @foo
=> "instance-variable"
irb(main):004:0> send(:remove_instance_variable, :@foo)
=> "bar"
irb(main):005:0> defined? @foo
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment