Sha256: 1033207c806a73d110b51d311fbb266606e8029f4ba1add6710fe1481d97fc08
Contents?: true
Size: 374 Bytes
Versions: 2
Compression:
Stored size: 374 Bytes
Contents
class Cache def initialize(instance, method) @data = {} @instance = instance @method = method end def get(key) begin @data.fetch(key) rescue KeyError set(key) get(key) end end def set(key) @data.store key, value(key) end private def value(key) @instance.get_info(key).send @method end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
paymo-0.0.2 | lib/paymo/cache.rb |
paymo-0.0.1 | lib/paymo/cache.rb |