Class: GraphQL::Filter::MergedOnly Private

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/filter.rb

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

Direct Known Subclasses

MergedExcept

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(first, second) ⇒ MergedOnly

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.

Returns a new instance of MergedOnly.



26
27
28
29
# File 'lib/graphql/filter.rb', line 26

def initialize(first, second)
  @first = first
  @second = second
end

Class Method Details

.build(onlies) ⇒ 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.



35
36
37
38
39
40
41
42
43
44
# File 'lib/graphql/filter.rb', line 35

def self.build(onlies)
  case onlies.size
  when 0
    nil
  when 1
    onlies[0]
  else
    onlies.reduce { |memo, only| self.new(memo, only) }
  end
end

Instance Method Details

#call(member, ctx) ⇒ 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.



31
32
33
# File 'lib/graphql/filter.rb', line 31

def call(member, ctx)
  @first.call(member, ctx) && @second.call(member, ctx)
end