Method: GraphQL::Schema::Member::HasArguments#add_argument
- Defined in:
- lib/graphql/schema/member/has_arguments.rb
#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.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/graphql/schema/member/has_arguments.rb', line 70 def add_argument(arg_defn) @own_arguments ||= {} prev_defn = @own_arguments[arg_defn.name] case prev_defn when nil @own_arguments[arg_defn.name] = arg_defn when Array prev_defn << arg_defn when GraphQL::Schema::Argument @own_arguments[arg_defn.name] = [prev_defn, arg_defn] else raise "Invariant: unexpected `@own_arguments[#{arg_defn.name.inspect}]`: #{prev_defn.inspect}" end arg_defn end |