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.



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

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.



41
42
43
44
45
46
47
48
49
50
# File 'lib/graphql/filter.rb', line 41

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.



37
38
39
# File 'lib/graphql/filter.rb', line 37

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