lib/graphql/schema/field.rb
def extensions(new_extensions = nil)
        if new_extensions.nil?
          # Read the value
          @extensions
        else
          if @extensions.frozen?
            @extensions = @extensions.dup
          end
          new_extensions.each do |extension|
            if extension.is_a?(Hash)
              extension = extension.to_a[0]
              extension_class, options = *extension
              @extensions << extension_class.new(field: self, options: options)
            else
              extension_class = extension
              @extensions << extension_class.new(field: self, options: nil)
            end
          end
        end
      end
# Read extension instances from this field,
# or add new classes/options to be initialized on this field.
# Extensions are executed in the order they are added.
#
# @example adding an extension
#   extensions([MyExtensionClass])
#
# @example adding multiple extensions
#   extensions([MyExtensionClass, AnotherExtensionClass])
#
# @example adding an extension with options
#   extensions([MyExtensionClass, { AnotherExtensionClass => { filter: true } }])
#
# @param extensions [Array<Class, Hash<Class => Object>>] Add extensions to this field. For hash elements, only the first key/value is used.
# @return [Array<GraphQL::Schema::FieldExtension>] extensions to apply to this field
Read extension instances from this field,
or add new classes/options to be initialized on this field.
Extensions are executed in the order they are added.
Read extension instances from this field or add new classes / options to be initialized on this field . Extensions are executed in the order they are added .
def extensions(new_extensions = nil)
        if new_extensions.nil?
          @extensions
        else
          if @extensions.frozen?
            @extensions = @extensions.dup
          end
          new_extensions.each do |extension|
            if extension.is_a?(Hash)
              extension = extension.to_a[0]
              extension_class, options = *extension
              @extensions << extension_class.new(field: self, options: options)
            else
              extension_class = extension
              @extensions << extension_class.new(field: self, options: nil)
            end
          end
        end
      end
def extensions ( new_extensions = nil ) if new_extensions . nil? @extensions else if @extensions . frozen? @extensions = @extensions . dup end new_extensions . each do | extension | if extension . is_a? ( Hash ) extension = extension . to_a [ 0 ] extension_class , options = * extension @extensions << extension_class . new ( field : self , options : options ) else extension_class = extension @extensions << extension_class . new ( field : self , options : nil ) end end end end
Read extension instances from this field,
or add new classes/options to be initialized on this field.
Read extension instances from this field or add new classes / options to be initialized on this field .
# Read the value
extensions to apply to this field
extensions to apply to this field
Array<GraphQL::Schema::FieldExtension>
new_extensions
extensions
Add extensions to this field. For hash elements, only the first key/value is used.
Add extensions to this field . For hash elements only the first key / value is used .
example
adding an extension extensions([MyExtensionClass])
adding an extension extensions ( [ MyExtensionClass ] )
example
adding multiple extensions extensions([MyExtensionClass, AnotherExtensionClass])
adding multiple extensions extensions ( [ MyExtensionClass AnotherExtensionClass ] )
example
adding an extension with options extensions([MyExtensionClass, { AnotherExtensionClass => { filter: true } }])
adding an extension with options extensions ( [ MyExtensionClass { AnotherExtensionClass = > { filter : true } } ] )