Module: GraphQL::Schema::Directive::Flagged::VisibleByFlag

Defined in:
lib/graphql/schema/directive/flagged.rb

Instance Method Summary collapse

Instance Method Details

#visible?(context) ⇒ Boolean

Returns:



45
46
47
48
49
50
51
52
# File 'lib/graphql/schema/directive/flagged.rb', line 45

def visible?(context)
  if dir = self.directives.find { |d| d.is_a?(Flagged) }
    relevant_flags = (f = context[:flags]) && dir.arguments[:by] & f # rubocop:disable Development/ContextIsPassedCop -- definition-related
    relevant_flags && relevant_flags.any? && super
  else
    super
  end
end