Skip to content

Instantly share code, notes, and snippets.

@dwbutler
Last active January 4, 2017 04:52
Show Gist options
  • Save dwbutler/c0dc8f7d31d5eb5d697aaa7ea39b4f46 to your computer and use it in GitHub Desktop.
Save dwbutler/c0dc8f7d31d5eb5d697aaa7ea39b4f46 to your computer and use it in GitHub Desktop.
Find where a variable is overwritten with a different value
class Config
attr_accessor :thing
def thing=(val)
raise ArgumentError if defined?(@thing)
@thing = val
end
end
config = Config.new
config.thing = { "foo" => "bar" }
config.thing = nil
# overwritten.rb:5:in `thing=': ArgumentError (ArgumentError)
# from overwritten.rb:12:in `<main>'
@dwbutler
Copy link
Author

dwbutler commented Jan 4, 2017

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