lib/memoit.rb in memoit-0.4.0 vs lib/memoit.rb in memoit-0.4.1
- old
+ new
@@ -15,10 +15,10 @@
ivar_name = "@_memo_#{ivar_method_name}".to_sym
mod = Module.new do
define_method(name) do |*args, **kwargs, &block|
return super(*args, **kwargs, &block) if block
cache = instance_variable_get(ivar_name) || instance_variable_set(ivar_name, {})
- cache.fetch(args.hash) { |hash| cache[hash] = super(*args, **kwargs) }
+ cache.fetch([args, kwargs].hash) { |hash| cache[hash] = super(*args, **kwargs) }
end
end
prepend mod
name
end