diff --git a/packages/core/lib/open-uri/cached.rb b/packages/core/lib/open-uri/cached.rb index ac80a73c4..35c6f09d3 100644 --- a/packages/core/lib/open-uri/cached.rb +++ b/packages/core/lib/open-uri/cached.rb @@ -45,7 +45,7 @@ class Entry { } } - const reset = () => { + const clear = () => { cache = new Map() length = 0 lruList = [] @@ -148,8 +148,8 @@ def max=(maxLength) } end - def reset - `reset()` + def clear + `clear()` end end end diff --git a/packages/core/spec/node/asciidoctor.spec.js b/packages/core/spec/node/asciidoctor.spec.js index 54bd21e2d..70c708cf5 100644 --- a/packages/core/spec/node/asciidoctor.spec.js +++ b/packages/core/spec/node/asciidoctor.spec.js @@ -2279,7 +2279,7 @@ include::${testOptions.remoteBaseUri}/include-lines.adoc[lines=3..4] expect(requestsReceived.length).to.equal(2) } finally { asciidoctor.Cache.disable() - asciidoctor.Cache.reset() + asciidoctor.Cache.clear() asciidoctor.Cache.setMax(Opal.Asciidoctor.Cache.DEFAULT_MAX) } }) @@ -2309,7 +2309,7 @@ image::${testOptions.remoteBaseUri}/cc-zero.svg[opts=inline] expect(requestsReceived.map((request) => request.pathname)).to.have.members(['/cc-zero.svg', '/cc-heart.svg', '/cc-heart.svg']) } finally { asciidoctor.Cache.disable() - asciidoctor.Cache.reset() + asciidoctor.Cache.clear() asciidoctor.Cache.setMax(Opal.Asciidoctor.Cache.DEFAULT_MAX) } }) diff --git a/packages/core/src/template-asciidoctor-node.js b/packages/core/src/template-asciidoctor-node.js index dd09821c0..229c990c4 100644 --- a/packages/core/src/template-asciidoctor-node.js +++ b/packages/core/src/template-asciidoctor-node.js @@ -35,17 +35,15 @@ export default function (moduleConfig) { // Alias Opal.Asciidoctor.Cache = { disable: function () { - // QUESTION: should we also reset cache? const openUriSingleton = Opal.OpenURI.$singleton_class() if (Opal.OpenURI['$respond_to?']('original_open_uri')) { openUriSingleton.$send('remove_method', 'open_uri') openUriSingleton.$send('alias_method', 'open_uri', 'original_open_uri') } }, - reset: function() { - // QUESTION: should we also reset the max value? - if (typeof Opal.OpenURI.Cache['$reset'] === 'function') { - Opal.OpenURI.Cache['$reset']() + clear: function() { + if (typeof Opal.OpenURI.Cache['$clear'] === 'function') { + Opal.OpenURI.Cache['$clear']() } }, enable: function () {