class Type[T]

A class as a value, as x.class returns it and is_a? takes it: Int written in an expression is a Type[Int], Array[Int] a Type[Array[Int]], and x.class a Type[Object], also written Class. A Type of a subclass is a Type of its superclass (Type[StandardError] is a Type[Exception]). A class is constructed with new only where it is written (Array[Int].new, or new in a class method): a Type[T] value may hold a subclass whose initialize takes other arguments. At run time a class value carries no type arguments: Array[Int] and Array[String] are the same value.

<prelude>:116

Methods

def name -> String

The class's full name, with its namespace ("Task::Cancelled") and without type arguments ([1].class.name is "Array").

<prelude>:120

def <=(other: Type[Object]) -> Bool

Whether the class is other or a subclass of it (or includes it, for a module): Int <= Comparable. Type arguments are not compared.

<prelude>:123

def fields -> Array[Meta::Field]

Reflection, at compile time only (in a static def or a static statement): the class's fields, its own and inherited, in declaration order.

<prelude>:127

def field(name: Symbol) -> Meta::Field?

The field named name, if any.

<prelude>:129

def methods -> Array[Meta::MethodSig]

The signatures of the class's instance methods, its own and inherited, in declaration order; at compile time only.

<prelude>:132

def method?(name: Symbol) -> Bool

Whether the class has an instance method named name; at compile time only.

<prelude>:135

def includes?(m: Type[Object]) -> Bool

Whether the class includes the module m (or is m, or a subclass of it); at compile time only.

<prelude>:138