Class: Rails::GraphQL::Field::ScopedConfig

Inherits:
Struct
  • Object
show all
Defined in:
lib/rails/graphql/field/scoped_config.rb

Overview

Helper class to be used while configuring a field using a block. An instance of this class works as proxy for changes to the actual field.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fieldObject

Returns the value of attribute field

Returns:

  • (Object)

    the current value of field



7
8
9
# File 'lib/rails/graphql/field/scoped_config.rb', line 7

def field
  @field
end

#receiverObject

Returns the value of attribute receiver

Returns:

  • (Object)

    the current value of receiver



7
8
9
# File 'lib/rails/graphql/field/scoped_config.rb', line 7

def receiver
  @receiver
end

Instance Method Details

#desc(value) ⇒ Object Also known as: description



21
22
23
# File 'lib/rails/graphql/field/scoped_config.rb', line 21

def desc(value)
  field.description = value
end

#method_name(value) ⇒ Object



17
18
19
# File 'lib/rails/graphql/field/scoped_config.rb', line 17

def method_name(value)
  field.instance_variable_set(:@method_name, value.to_sym)
end

#rename!(name) ⇒ Object



13
14
15
# File 'lib/rails/graphql/field/scoped_config.rb', line 13

def rename!(name)
  field.instance_variable_set(:@gql_name, name.to_s)
end