Sha256: 9561bc7f196a2c0da688cf9aed15fd02a97e20a6913e21a372c07a6ab047b0f9

Contents?: true

Size: 968 Bytes

Versions: 43

Compression:

Stored size: 968 Bytes

Contents

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

43 entries across 43 versions & 1 rubygems

Version Path
graphql-1.2.6 lib/graphql/define/type_definer.rb
graphql-1.2.5 lib/graphql/define/type_definer.rb
graphql-1.2.4 lib/graphql/define/type_definer.rb
graphql-1.2.3 lib/graphql/define/type_definer.rb
graphql-1.2.2 lib/graphql/define/type_definer.rb
graphql-1.2.1 lib/graphql/define/type_definer.rb
graphql-1.2.0 lib/graphql/define/type_definer.rb
graphql-1.1.0 lib/graphql/define/type_definer.rb
graphql-1.0.0 lib/graphql/define/type_definer.rb
graphql-0.19.4 lib/graphql/define/type_definer.rb
graphql-0.19.3 lib/graphql/define/type_definer.rb
graphql-0.19.2 lib/graphql/define/type_definer.rb
graphql-0.19.1 lib/graphql/define/type_definer.rb
graphql-0.19.0 lib/graphql/define/type_definer.rb
graphql-0.18.15 lib/graphql/define/type_definer.rb
graphql-0.18.14 lib/graphql/define/type_definer.rb
graphql-0.18.13 lib/graphql/define/type_definer.rb
graphql-0.18.12 lib/graphql/define/type_definer.rb
graphql-0.18.11 lib/graphql/define/type_definer.rb
graphql-0.18.10 lib/graphql/define/type_definer.rb