Class: JSONSchemer::CachedRefResolver
- Inherits:
-
Object
- Object
- JSONSchemer::CachedRefResolver
- Defined in:
- lib/json_schemer/cached_ref_resolver.rb
Instance Method Summary collapse
- #call(uri) ⇒ Object
-
#initialize(&ref_resolver) ⇒ CachedRefResolver
constructor
A new instance of CachedRefResolver.
Constructor Details
#initialize(&ref_resolver) ⇒ CachedRefResolver
Returns a new instance of CachedRefResolver.
4 5 6 7 |
# File 'lib/json_schemer/cached_ref_resolver.rb', line 4 def initialize(&ref_resolver) @ref_resolver = ref_resolver @cache = {} end |
Instance Method Details
#call(uri) ⇒ Object
9 10 11 12 |
# File 'lib/json_schemer/cached_ref_resolver.rb', line 9 def call(uri) @cache[uri] = @ref_resolver.call(uri) unless @cache.key?(uri) @cache[uri] end |