Sha256: 98aed5e8a773b4fe0a67beee0b64b3ec6486b3dc5d58a678ec0cc2d2b3191cdd

Contents?: true

Size: 824 Bytes

Versions: 7

Compression:

Stored size: 824 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  # There are two ways to apply the deprecated `!` DSL to class-style schema definitions:
  #
  # 1. Scoped by file (CRuby only), add to the top of the file:
  #
  #      using GraphQL::DeprecatedDSL
  #
  #   (This is a "refinement", there are also other ways to scope it.)
  #
  # 2. Global application, add before schema definition:
  #
  #      GraphQL::DeprecatedDSL.activate
  #
  module DeprecatedDSL
    def self.activate
      GraphQL::Schema::Member.extend(Methods)
      GraphQL::Schema::Member::ListTypeProxy.include(Methods)
      GraphQL::Schema::Member::NonNullTypeProxy.include(Methods)
    end
    module Methods
      def !
        to_non_null_type
      end
    end
    refine GraphQL::Schema::Member.singleton_class do
      include Methods
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
graphql-1.8.0.pre9 lib/graphql/deprecated_dsl.rb
graphql-1.8.0.pre8 lib/graphql/deprecated_dsl.rb
graphql-1.8.0.pre7 lib/graphql/deprecated_dsl.rb
graphql-1.8.0.pre6 lib/graphql/deprecated_dsl.rb
graphql-1.8.0.pre5 lib/graphql/deprecated_dsl.rb
graphql-1.8.0.pre4 lib/graphql/deprecated_dsl.rb
graphql-1.8.0.pre3 lib/graphql/deprecated_dsl.rb