Last active
January 4, 2017 04:52
-
-
Save dwbutler/c0dc8f7d31d5eb5d697aaa7ea39b4f46 to your computer and use it in GitHub Desktop.
Find where a variable is overwritten with a different value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From the
Missing Pieces Wish List
on http://www.schneems.com/2016/01/25/ruby-debugging-magic-cheat-sheet.html