Skip to content

Instantly share code, notes, and snippets.

@hokaccha
Created October 26, 2012 06:39
Show Gist options
  • Save hokaccha/3957257 to your computer and use it in GitHub Desktop.
Save hokaccha/3957257 to your computer and use it in GitHub Desktop.
#!/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