module GraphQLPreview class Mask def self.call(member, context) 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