Class: RBI::Type::TypeParameter

Inherits:
RBI::Type show all
Extended by:
T::Sig
Defined in:
lib/rbi/type.rb

Overview

A type parameter like ‘T.type_parameter(:U)`.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RBI::Type

all, any, anything, attached_class, boolean, class_of, #eql?, generic, #hash, #nilable, nilable, #nilable?, #non_nilable, noreturn, parse_node, parse_string, proc, #rbs_string, self_type, shape, simple, t_class, #to_s, tuple, type_parameter, untyped, void

Constructor Details

#initialize(name) ⇒ TypeParameter

Returns a new instance of TypeParameter.



314
315
316
317
# File 'lib/rbi/type.rb', line 314

def initialize(name)
  super()
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



311
312
313
# File 'lib/rbi/type.rb', line 311

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



320
321
322
# File 'lib/rbi/type.rb', line 320

def ==(other)
  TypeParameter === other && @name == other.name
end

#to_rbiObject



325
326
327
# File 'lib/rbi/type.rb', line 325

def to_rbi
  "T.type_parameter(#{@name.inspect})"
end