Module: GraphQL::Schema::AcceptsDefinition::InitializeExtension

Defined in:
lib/graphql/schema/member.rb

Instance Method Summary collapse

Instance Method Details

#accepts_definition_methodsObject



150
151
152
# File 'lib/graphql/schema/member.rb', line 150

def accepts_definition_methods
  self.class.accepts_definition_methods
end

#initialize(*args, **kwargs, &block) ⇒ Object



137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/graphql/schema/member.rb', line 137

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