Class: Rails::GraphQL::Helpers::WithSchemaFields::ScopedConfig

Inherits:
Struct
  • Object
show all
Defined in:
lib/rails/graphql/helpers/with_schema_fields.rb

Overview

Helper class to be used as the self in configuration blocks

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, **xargs, &block) ⇒ Object (private)



45
46
47
48
49
# File 'lib/rails/graphql/helpers/with_schema_fields.rb', line 45

def method_missing(method_name, *args, **xargs, &block)
  schema_method = schema_methods[method_name]
  args.unshift(type) unless schema_method.nil?
  source.send(schema_method || method_name, *args, **xargs, &block)
end

Instance Attribute Details

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



29
30
31
# File 'lib/rails/graphql/helpers/with_schema_fields.rb', line 29

def source
  @source
end

#typeObject Also known as: kind

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



29
30
31
# File 'lib/rails/graphql/helpers/with_schema_fields.rb', line 29

def type
  @type
end

Instance Method Details

#argument(*args, **xargs, &block) ⇒ Object Also known as: arg



30
31
32
33
# File 'lib/rails/graphql/helpers/with_schema_fields.rb', line 30

def argument(*args, **xargs, &block)
  xargs[:owner] ||= source
  GraphQL::Argument.new(*args, **xargs, &block)
end