ruby-uebungen/Assignment_022/solution
Thomas Smits fe2c1c6eb6 Update of exercises 2023-05-25 17:47:19 +02:00
..
readme.md Update of exercises 2023-05-25 17:47:19 +02:00

readme.md

Lösung: Hashes und Blöcke

















































































```ruby class Cache def initialize(&callback) @data = {} @callback = callback end

def add(key, value) @data[key] = value end

def @data[key] = @callback.call(key) unless @data.has_key?(key) @data[key] end end