lib/dry/effects/effects/cache.rb in dry-effects-0.1.1 vs lib/dry/effects/effects/cache.rb in dry-effects-0.1.2
- old
+ new
@@ -8,11 +8,13 @@
class Cache < ::Module
class CacheEffect < Effect
option :scope
end
- def initialize(scope, shared: false)
- if scope.is_a?(::Hash)
+ def initialize(scope = nil, shared: false, **kw)
+ if !kw.empty?
+ scope, as = kw.to_a[0]
+ elsif scope.is_a?(::Hash)
scope, as = scope.to_a[0]
else
as = :cache
end