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, t_module, #to_s, tuple, type_alias, type_parameter, untyped, void

Constructor Details

#initialize(name) ⇒ TypeParameter

: (Symbol name) -> void



592
593
594
595
# File 'lib/rbi/type.rb', line 592

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

Instance Attribute Details

#nameObject (readonly)

: Symbol



589
590
591
# File 'lib/rbi/type.rb', line 589

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object

: (BasicObject other) -> bool



599
600
601
# File 'lib/rbi/type.rb', line 599

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

#normalizeObject

: -> Type



611
612
613
# File 'lib/rbi/type.rb', line 611

def normalize
  self
end

#simplifyObject

: -> Type



617
618
619
# File 'lib/rbi/type.rb', line 617

def simplify
  self
end

#to_rbiObject

: -> String



605
606
607
# File 'lib/rbi/type.rb', line 605

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