Sha256: d6633d933a246e31de100f7b5d4565050636eb57040dd893616b389b20d3caef

Contents?: true

Size: 492 Bytes

Versions: 2

Compression:

Stored size: 492 Bytes

Contents

module GraphQLPreview
  class Mask
    def self.call(member, context)
      return false unless member.respond_to?(:metadata)
      return false unless member.metadata.key?(:preview_toggled_by)
      unless context.key?(:schema_previews)
        raise ArgumentError, "You are using the `GraphQLPreview::Mask`, but key `:schema_previews` was not provided to the `context`"
      end

      !context[:schema_previews].include?(member.metadata[:preview_toggled_by].toggled_by)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graphql-preview-0.0.6 lib/graphql-preview/mask.rb
graphql-preview-0.0.5 lib/graphql-preview/mask.rb