Skip to content

Commit

Permalink
rename (key? -> cached?) and make public
Browse files Browse the repository at this point in the history
  • Loading branch information
takahashim committed Aug 14, 2024
1 parent 2c050b8 commit 00dfb94
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/review/book/cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ def reset
def fetch(key, &block)
raise ArgumentError, 'Key should be Symbol' unless key.is_a?(Symbol)

if key?(key)
if cached?(key)
read(key)
else
exec_block_and_save(key, &block)
end
end

private

def key?(key)
def cached?(key)
@store.key?(key)
end

private

def read(key)
@store[key]
end
Expand Down

0 comments on commit 00dfb94

Please sign in to comment.