Module: GraphQL::Define::InstanceDefinable

Included in:
Argument, BaseType, GraphQL::Directive, EnumType::EnumValue, Field, Relay::Mutation, Schema
Defined in:
lib/graphql/define/instance_definable.rb

Defined Under Namespace

Modules: ClassMethods, DeprecatedDefine Classes: AssignAttribute, AssignMetadataKey, Definition

Instance Method Summary collapse

Instance Method Details

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


43
44
45
# File 'lib/graphql/define/instance_definable.rb', line 43

def define(**kwargs, &block)
  deprecated_define(**kwargs, &block)
end

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


34
35
36
37
38
39
40
# File 'lib/graphql/define/instance_definable.rb', line 34

def deprecated_define(**kwargs, &block)
  # make sure the previous definition_proc was executed:
  ensure_defined
  stash_dependent_methods
  @pending_definition = Definition.new(kwargs, block)
  nil
end

#initialize_copy(other) ⇒ Object


55
56
57
58
# File 'lib/graphql/define/instance_definable.rb', line 55

def initialize_copy(other)
  super
  @metadata = other..dup
end

#metadataObject


29
30
31
# File 'lib/graphql/define/instance_definable.rb', line 29

def 
  @metadata ||= {}
end

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


48
49
50
51
52
53
# File 'lib/graphql/define/instance_definable.rb', line 48

def redefine(**kwargs, &block)
  ensure_defined
  new_inst = self.dup
  new_inst.deprecated_define(**kwargs, &block)
  new_inst
end