Sha256: 34fb20e1ae00856776f6f243783b81058cd365d03cebb039663cfc821422d540

Contents?: true

Size: 496 Bytes

Versions: 1

Compression:

Stored size: 496 Bytes

Contents

module GraphQLPreview
  class Mask
    def self.call(member, context)
      return false if Library::Schema.enabled_previews.nil?
      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

1 entries across 1 versions & 1 rubygems

Version Path
graphql-preview-0.0.2 lib/graphql-preview/mask.rb