Method: GraphQL::Schema::Interface::DefinitionMethods#definition_methods

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

#definition_methods(&block) ⇒ Object

Methods defined in this block will be:

  • Added as class methods to this interface
  • Added as class methods to all child interfaces


23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/graphql/schema/interface.rb', line 23

def definition_methods(&block)
  # Use an instance variable to tell whether it's been included previously or not;
  # You can't use constant detection because constants are brought into scope
  # by `include`, which has already happened at this point.
  if !defined?(@_definition_methods)
    defn_methods_module = Module.new
    @_definition_methods = defn_methods_module
    const_set(:DefinitionMethods, defn_methods_module)
    extend(self::DefinitionMethods)
  end
  self::DefinitionMethods.module_exec(&block)
end