Created
October 26, 2012 06:39
-
-
Save hokaccha/3957257 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env ruby | |
# https://gist.github.com/3957219 | |
@cache = nil | |
def hoge | |
@cache ||= Proc.new { | |
fuga = piyo() | |
"result: #{fuga}" | |
}.call | |
end | |
def piyo | |
puts "called piyo" | |
return 42 | |
end | |
puts hoge() | |
puts hoge() | |
puts hoge() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment