Module: GraphQL::Schema::Mask Private

Defined in:
lib/graphql/schema/mask.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Tools for working with schema masks (only / except).

In general, these are functions which, when they return true, the member is hidden for the current query.

Defined Under Namespace

Classes: EitherMask, InvertedMask

Class Method Summary collapse

Class Method Details

.combine(default_mask, except:, only:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Combine a schema's default_mask with query-level masks.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/graphql/schema/mask.rb', line 14

def combine(default_mask, except:, only:)
  query_mask = if except
    except
  elsif only
    InvertedMask.new(only)
  end

  if query_mask && (default_mask != GraphQL::Schema::NullMask)
    EitherMask.new(default_mask, query_mask)
  else
    query_mask || default_mask
  end
end