Module: Bibliothecary::Analyser::TryCache

Included in:
MultiParsers::CycloneDX, MultiParsers::DependenciesCSV, MultiParsers::Spdx
Defined in:
lib/bibliothecary/analyser.rb

Instance Method Summary collapse

Instance Method Details

#try_cache(options, key) ⇒ Object



39
40
41
42
43
44
45
46
47
# File 'lib/bibliothecary/analyser.rb', line 39

def try_cache(options, key)
  if options[:cache]
    options[:cache][key] ||= yield

    options[:cache][key]
  else
    yield
  end
end