lib/rails/graphql/helpers/with_directives.rb
def use(item_or_symbol, *list, **xargs)
          if item_or_symbol.is_a?(Symbol)
            directive = fetch!(item_or_symbol)
            raise ArgumentError, <<~MSG.squish unless directive < GraphQL::Directive
              Unable to find the #{item_or_symbol.inspect} directive.
            MSG

            list = [directive.new(**xargs)]
          else
            list << item_or_symbol
          end

          current = try(:all_directives) || @directives
          items = GraphQL.directives_to_set(list, current, source: self)
          directives.merge(items)
        rescue DefinitionError => e
          raise e.class, e.message + "\n  Defined at: #{caller(2)[0]}"
        end
# Use this method to assign directives to the given definition. You can
# also provide a symbol as a first argument and extra named-arguments
# to auto initialize a new instance of that directive.
Use this method to assign directives to the given definition. You can
also provide a symbol as a first argument and extra named-arguments
to auto initialize a new instance of that directive.
Use this method to assign directives to the given definition . You can also provide a symbol as a first argument and extra named - arguments to auto initialize a new instance of that directive .
def use(item_or_symbol, *list, **xargs)
          if item_or_symbol.is_a?(Symbol)
            directive = fetch!(item_or_symbol)
            raise ArgumentError, <<~MSG.squish unless directive < GraphQL::Directive
              Unable to find the #{item_or_symbol.inspect} directive.
            MSG
            list = [directive.new(**xargs)]
          else
            list << item_or_symbol
          end
          current = try(:all_directives) || @directives
          items = GraphQL.directives_to_set(list, current, source: self)
          directives.merge(items)
        rescue DefinitionError => e
          raise e.class, e.message + "\n  Defined at: #{caller(2)[0]}"
        end
def use ( item_or_symbol , * list , ** xargs ) if item_or_symbol . is_a? ( Symbol ) directive = fetch! ( item_or_symbol ) raise ArgumentError , <<~MSG . squish unless directive < GraphQL :: Directive 
              Unable to find the  #{ item_or_symbol . inspect }  directive.
             MSG list = [ directive . new ( ** xargs ) ] else list << item_or_symbol end current = try ( :all_directives ) || @directives items = GraphQL . directives_to_set ( list , current , source : self ) directives . merge ( items ) rescue DefinitionError => e raise e . class , e . message + "\n  Defined at: #{caller(2)[0]}" end
Use this method to assign directives to the given definition.
Use this method to assign directives to the given definition .
item_or_symbol
list
xargs