Skip to content

Commit

Permalink
Rename reset to clear
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Apr 24, 2022
1 parent 2a3878a commit aba02c0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
6 changes: 3 additions & 3 deletions packages/core/lib/open-uri/cached.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Entry {
}
}
const reset = () => {
const clear = () => {
cache = new Map()
length = 0
lruList = []
Expand Down Expand Up @@ -148,8 +148,8 @@ def max=(maxLength)
}
end

def reset
`reset()`
def clear
`clear()`
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions packages/core/spec/node/asciidoctor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
Expand Down Expand Up @@ -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)
}
})
Expand Down
8 changes: 3 additions & 5 deletions packages/core/src/template-asciidoctor-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit aba02c0

Please sign in to comment.