-
-
Save rafaelss/3176106 to your computer and use it in GitHub Desktop.
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 A | |
def foo | |
case true | |
when true | |
puts defined?(bar) | |
puts "nil? #{bar}" | |
when false | |
bar = "something else" | |
raise "here? no" | |
end | |
puts defined?(bar) | |
puts "nil? #{bar.inspect}" | |
end | |
def bar | |
@bar ||= "baz" | |
end | |
end | |
A.new.foo |
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
$ ruby tmp/a.rb | |
method | |
nil? baz | |
local-variable | |
nil? nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment