module CachedRunOnce
Constants
- VERSION
Public Instance Methods
cached_run_once() { || ... }
click to toggle source
# File lib/cached_run_once.rb, line 4 def cached_run_once @_cached_run_once_methods ||= {} label = caller_locations(1, 1)[0].label unless @_cached_run_once_methods.has_key? label result = yield @_cached_run_once_methods[label] = result end @_cached_run_once_methods[label] end