lib/rails/graphql/source.rb
# Helper method to create a class based on the given +type+ and allows
# several other settings to be executed on it
Helper method to create a class based on the given +type+ and allows
several other settings to be executed on it
Helper method to create a class based on the given + type + and allows several other settings to be executed on it
def create_type(type = nil, **xargs, &block)
            name = "#{gql_module.name}::#{xargs.delete(:as) || base_name}"
            superclass = xargs.delete(:superclass)
            with_owner = xargs.delete(:with_owner)
            if superclass.nil?
              superclass = type.to_s.classify
            elsif superclass.is_a?(String)
              superclass = superclass.constantize
            end
            source = self
            Schema.send(:create_type, name, superclass, **xargs) do
              include Helpers::WithOwner if with_owner
              set_namespaces(*source.namespaces)
              self.owner = source if respond_to?(:owner=)
              self.assigned_to = source.safe_assigned_class \
                if source.assigned? && is_a?(Helpers::WithAssignment)
              instance_exec(&block) if block.present?
            end
          end
def create_type ( type = nil , ** xargs , & block ) name = "#{gql_module.name}::#{xargs.delete(:as) || base_name}" superclass = xargs . delete ( :superclass ) with_owner = xargs . delete ( :with_owner ) if superclass . nil? superclass = type . to_s . classify elsif superclass . is_a? ( String ) superclass = superclass . constantize end source = self Schema . send ( :create_type , name , superclass , ** xargs ) do include Helpers :: WithOwner if with_owner set_namespaces ( * source . namespaces ) self . owner = source if respond_to? ( :owner= ) self . assigned_to = source . safe_assigned_class if source . assigned? && is_a? ( Helpers :: WithAssignment ) instance_exec ( & block ) if block . present? end end
Helper method to create a class based on the given +type+ and allows
several other settings to be executed on it
Helper method to create a class based on the given + type + and allows several other settings to be executed on it
type
xargs
block