Class: Statsig::Memo
- Inherits:
-
Object
- Object
- Statsig::Memo
- Defined in:
- lib/memo.rb
Class Method Summary collapse
Class Method Details
.for(hash, method, key) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/memo.rb', line 6 def self.for(hash, method, key) if key != nil method_hash = hash[method] unless method_hash method_hash = hash[method] = {} end return method_hash[key] if method_hash.key?(key) end method_hash[key] = yield end |
.for_global(method, key) ⇒ Object
19 20 21 22 23 |
# File 'lib/memo.rb', line 19 def self.for_global(method, key) return self.for(@global_memo, method, key) do yield end end |