Sha256: 72d039e83c1fecd8c082617b42468685c5ecb4d988dbc4c9b31d2f42af5e130a

Contents?: true

Size: 665 Bytes

Versions: 6

Compression:

Stored size: 665 Bytes

Contents

module GraphQL
  class Schema
    # A two-level map with fields as the last values.
    # The first level is type names, which point to a second map.
    # The second level is field names, which point to fields.
    #
    # The catch is, the fields in this map _may_ have been modified by being instrumented.
    class InstrumentedFieldMap
      def initialize(schema)
        @storage = Hash.new { |h, k| h[k] = {} }
      end

      def set(type_name, field_name, field)
        @storage[type_name][field_name] = field
      end

      def get(type_name, field_name)
        type = @storage[type_name]
        type && type[field_name]
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
graphql-1.2.4 lib/graphql/schema/instrumented_field_map.rb
graphql-1.2.3 lib/graphql/schema/instrumented_field_map.rb
graphql-1.2.2 lib/graphql/schema/instrumented_field_map.rb
graphql-1.2.1 lib/graphql/schema/instrumented_field_map.rb
graphql-1.2.0 lib/graphql/schema/instrumented_field_map.rb
graphql-1.1.0 lib/graphql/schema/instrumented_field_map.rb