Module: GraphQL::Schema::Member::AcceptsDefinition::InitializeExtension Private

Defined in:
lib/graphql/schema/member/accepts_definition.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.

Instance Method Summary collapse

Instance Method Details

#accepts_definition_methodsObject

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.


145
146
147
# File 'lib/graphql/schema/member/accepts_definition.rb', line 145

def accepts_definition_methods
  self.class.accepts_definition_methods
end

#initialize(*args, **kwargs, &block) ⇒ 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.


132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/graphql/schema/member/accepts_definition.rb', line 132

def initialize(*args, **kwargs, &block)
  self.class.accepts_definition_methods.each do |method_name|
    if kwargs.key?(method_name)
      value = kwargs.delete(method_name)
      if !value.is_a?(Array)
        value = [value]
      end
      instance_variable_set("@#{method_name}_args", value)
    end
  end
  super(*args, **kwargs, &block)
end