Class: RBI::Type::TypeParameter

Inherits:
RBI::Type show all
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

: (Symbol name) -> void



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

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

Instance Attribute Details

#nameObject (readonly)

: Symbol



307
308
309
# File 'lib/rbi/type.rb', line 307

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object

: (BasicObject other) -> bool



317
318
319
# File 'lib/rbi/type.rb', line 317

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

#to_rbiObject

: -> String



323
324
325
# File 'lib/rbi/type.rb', line 323

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