Created
January 24, 2012 04:19
-
-
Save danielhopkins/1667793 to your computer and use it in GitHub Desktop.
But why?
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 TryIt | |
def []=(k,v) return "I'm a return value, if I'm not returned where do I go?" end | |
end | |
t = TryIt.new | |
puts(t['blah'] = "It would be slightly surprising if I were returned, right?") | |
#=> "It would be slightly surprising if I were returned, right?" |
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 TryIt | |
def []=(k,v) | |
raise 'look at the stack' | |
return "I'm a return value, if I'm not returned where do I go?" | |
end | |
end | |
t = TryIt.new | |
puts(t['blah'] = "It would be slightly surprising if I were returned, right?") | |
#=> | |
# testit.rb:3:in `[]=': look at the stack (RuntimeError) | |
# from testit.rb:9:in `<main>' | |
# update from sublime | |
# update from sublime 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment