class GraphQL::Schema::Directive::Flagged
In this case, the server hides types and fields entirely, unless the current context has certain ‘:flags` present.
This is similar to {Directive::Feature}, except it’s prescribed by the server, not the client.
def initialize(target, **options)
def initialize(target, **options) if target.is_a?(Module) # This is type class of some kind, `include` will put this module # in between the type class itself and its super class, so `super` will work fine target.include(VisibleByFlag) elsif !target.is_a?(VisibleByFlag) # This is an instance of a base class. `include` won't put this in front of the # base class implementation, so we need to `.prepend`. # `#visible?` could probably be moved to a module and then this could use `include` instead. target.class.prepend(VisibleByFlag) end super end