Sha256: 9024a07b0039c06651c929901f571a7c0bd84714301f5425ffad22e72f86afce

Contents?: true

Size: 293 Bytes

Versions: 20

Compression:

Stored size: 293 Bytes

Contents

# frozen_string_literal: true
module JSONSchemer
  class CachedRefResolver
    def initialize(&ref_resolver)
      @ref_resolver = ref_resolver
      @cache = {}
    end

    def call(uri)
      @cache[uri] = @ref_resolver.call(uri) unless @cache.key?(uri)
      @cache[uri]
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
json_schemer-0.2.21 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.20 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.19 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.18 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.17 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.16 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.15 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.14 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.13 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.12 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.11 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.10 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.9 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.8 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.7 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.6 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.5 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.4 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.3 lib/json_schemer/cached_ref_resolver.rb
json_schemer-0.2.2 lib/json_schemer/cached_ref_resolver.rb