Module: GraphQL::Schema::Member::HasArguments Private
- Included in:
 - Directive, Field, InputObject, Resolver
 
- Defined in:
 - lib/graphql/schema/member/has_arguments.rb
 
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Modules: ArgumentClassAccessor, ArgumentObjectLoader
Instance Method Summary collapse
- 
  
    
      #add_argument(arg_defn)  ⇒ GraphQL::Schema::Argument 
    
    
  
  
  
  
  
  
  
  private
  
    
Register this argument with the class.
 - 
  
    
      #argument(*args, **kwargs, &block)  ⇒ GraphQL::Schema::Argument 
    
    
  
  
  
  
  
  
  
  private
  
    
An instance of arguments_class, created from
*args. - 
  
    
      #argument_class(new_arg_class = nil)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  private
  
    
 - 
  
    
      #argument_with_loads(name, type, *rest, loads: nil, **kwargs)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  private
  
    
 - 
  
    
      #arguments  ⇒ Hash<String => GraphQL::Schema::Argument] Arguments defined on this thing, keyed by name. Includes inherited definitions 
    
    
  
  
  
  
  
  
  
  private
  
    
Hash<String => GraphQL::Schema::Argument] Arguments defined on this thing, keyed by name.
 - 
  
    
      #own_arguments  ⇒ Object 
    
    
  
  
  
  
  
  
  
  private
  
    
 
Instance Method Details
#add_argument(arg_defn) ⇒ GraphQL::Schema::Argument
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.
Register this argument with the class.
      48 49 50 51  | 
    
      # File 'lib/graphql/schema/member/has_arguments.rb', line 48 def add_argument(arg_defn) own_arguments[arg_defn.name] = arg_defn arg_defn end  | 
  
#argument(*args, **kwargs, &block) ⇒ GraphQL::Schema::Argument
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 An instance of arguments_class, created from *args
      39 40 41 42 43  | 
    
      # File 'lib/graphql/schema/member/has_arguments.rb', line 39 def argument(*args, **kwargs, &block) kwargs[:owner] = self arg_defn = self.argument_class.new(*args, **kwargs, &block) add_argument(arg_defn) end  | 
  
#argument_class(new_arg_class = nil) ⇒ 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.
      65 66 67  | 
    
      # File 'lib/graphql/schema/member/has_arguments.rb', line 65 def argument_class(new_arg_class = nil) self.class.argument_class(new_arg_class) end  | 
  
#argument_with_loads(name, type, *rest, loads: nil, **kwargs) ⇒ 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.
      16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35  | 
    
      # File 'lib/graphql/schema/member/has_arguments.rb', line 16 def argument_with_loads(name, type, *rest, loads: nil, **kwargs) if loads name_as_string = name.to_s inferred_arg_name = case name_as_string when /_id$/ name_as_string.sub(/_id$/, "").to_sym when /_ids$/ name_as_string.sub(/_ids$/, "") .sub(/([^s])$/, "\\1s") .to_sym else name end kwargs[:as] ||= inferred_arg_name end return [name, type, *rest, **kwargs] end  | 
  
#arguments ⇒ Hash<String => GraphQL::Schema::Argument] Arguments defined on this thing, keyed by name. Includes inherited definitions
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 Hash<String => GraphQL::Schema::Argument] Arguments defined on this thing, keyed by name. Includes inherited definitions
      54 55 56 57 58 59 60 61 62  | 
    
      # File 'lib/graphql/schema/member/has_arguments.rb', line 54 def arguments inherited_arguments = ((self.is_a?(Class) && superclass.respond_to?(:arguments)) ? superclass.arguments : nil) # Local definitions override inherited ones if inherited_arguments inherited_arguments.merge(own_arguments) else own_arguments end end  | 
  
#own_arguments ⇒ 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.
      136 137 138  | 
    
      # File 'lib/graphql/schema/member/has_arguments.rb', line 136 def own_arguments @own_arguments ||= {} end  |