Module: DepsGrapher::SourceCache::Registry
- Defined in:
- lib/deps_grapher/source_cache/registry.rb
Class Method Summary collapse
- .fetch(name) ⇒ Object (also: [])
- .key?(name) ⇒ Boolean
- .register(by_const_name, by_location) ⇒ Object
- .with_cache(key) {|@cache_restoration| ... } ⇒ Object
Class Method Details
.fetch(name) ⇒ Object Also known as: []
7 8 9 10 11 |
# File 'lib/deps_grapher/source_cache/registry.rb', line 7 def fetch(name) registry.fetch name rescue KeyError raise SourceCacheNotFound, "source cache not found: #{name}" end |
.key?(name) ⇒ Boolean
14 15 16 |
# File 'lib/deps_grapher/source_cache/registry.rb', line 14 def key?(name) registry.key? name end |
.register(by_const_name, by_location) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/deps_grapher/source_cache/registry.rb', line 18 def register(by_const_name, by_location) by_const_name.each do |const_name, location| registry[const_name] ||= location end by_location.each do |location, const_name| registry[location] ||= const_name end end |
.with_cache(key) {|@cache_restoration| ... } ⇒ Object
28 29 30 31 32 33 |
# File 'lib/deps_grapher/source_cache/registry.rb', line 28 def with_cache(key) cache_file = DepsGrapher.cache_file key restore_cache! cache_file yield @cache_restoration persist_cache! cache_file end |