lib/task_helper/api/cache.rb in task_helper-0.0.1 vs lib/task_helper/api/cache.rb in task_helper-0.0.2

- old
+ new

@@ -1,14 +1,15 @@ module TaskHelper module API class Cache - def initialize(limit: 10) + def initialize(limit: 0, **call_defaults) @limit = limit + @call_defaults = call_defaults @calls = [] end def get(**args) - new_call = Call.new(args) + new_call = Call.new(@call_defaults.merge(args)) cached_call = @calls.find { |call| call == new_call } if cached_call cached_call.run else @calls << new_call