Module: GraphQL::Define::InstanceDefinable::DeprecatedDefine

Included in:
EnumType, InputObjectType, InterfaceType, ObjectType, ScalarType, Schema, UnionType
Defined in:
lib/graphql/define/instance_definable.rb

Instance Method Summary collapse

Instance Method Details

#define(**kwargs, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/graphql/define/instance_definable.rb', line 7

def define(**kwargs, &block)
  deprecated_caller = caller(1, 1).first
  if deprecated_caller.include?("lib/graphql")
    deprecated_caller = caller(2, 10).find { |c| !c.include?("lib/graphql") }
  end

  if deprecated_caller
    GraphQL::Deprecation.warn <<-ERR
#{self}.define will be removed in GraphQL-Ruby 2.0; use a class-based definition instead. See https://graphql-ruby.org/schema/class_based_api.html.
  -> called from #{deprecated_caller}
ERR
  end
  deprecated_define(**kwargs, &block)
end