Sha256: f9bb5f27e828df23d040e3450283cbe12aef9969684e15ea77db5b3009ff3c9b

Contents?: true

Size: 998 Bytes

Versions: 34

Compression:

Stored size: 998 Bytes

Contents

# frozen_string_literal: true
module GraphQL
  module Define
    # Some conveniences for definining return & argument types.
    #
    # Passed into initialization blocks, eg {ObjectType#initialize}, {Field#initialize}
    class TypeDefiner
      include Singleton
      # rubocop:disable Style/MethodName
      def Int;      GraphQL::INT_TYPE;      end
      def String;   GraphQL::STRING_TYPE;   end
      def Float;    GraphQL::FLOAT_TYPE;    end
      def Boolean;  GraphQL::BOOLEAN_TYPE;  end
      def ID;       GraphQL::ID_TYPE;       end
      # rubocop:enable Style/MethodName

      # Make a {ListType} which wraps the input type
      #
      # @example making a list type
      #   list_of_strings = types[types.String]
      #   list_of_strings.inspect
      #   # => "[String]"
      #
      # @param type [Type] A type to be wrapped in a ListType
      # @return [GraphQL::ListType] A ListType wrapping `type`
      def [](type)
        type.to_list_type
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
graphql-1.7.3 lib/graphql/define/type_definer.rb
graphql-1.7.2 lib/graphql/define/type_definer.rb
graphql-1.7.1 lib/graphql/define/type_definer.rb
graphql-1.7.0 lib/graphql/define/type_definer.rb
graphql-1.6.8 lib/graphql/define/type_definer.rb
graphql-1.6.7 lib/graphql/define/type_definer.rb
graphql-1.6.6 lib/graphql/define/type_definer.rb
graphql-1.6.5 lib/graphql/define/type_definer.rb
graphql-1.6.4 lib/graphql/define/type_definer.rb
graphql-1.5.15 lib/graphql/define/type_definer.rb
graphql-1.6.3 lib/graphql/define/type_definer.rb
graphql-1.6.2 lib/graphql/define/type_definer.rb
graphql-1.6.1 lib/graphql/define/type_definer.rb
graphql-1.6.0 lib/graphql/define/type_definer.rb
graphql-1.5.14 lib/graphql/define/type_definer.rb
graphql-1.5.13 lib/graphql/define/type_definer.rb
graphql-1.5.7.1 lib/graphql/define/type_definer.rb
graphql-1.5.12 lib/graphql/define/type_definer.rb
graphql-1.5.11 lib/graphql/define/type_definer.rb
graphql-1.5.10 lib/graphql/define/type_definer.rb