Class: RBI::Type::Simple

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

Overview

A type that represents a simple class name like ‘String` or `Foo`.

It can also be a qualified name like ‘::Foo` or `Foo::Bar`.

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) ⇒ Simple

Returns a new instance of Simple.



24
25
26
27
# File 'lib/rbi/type.rb', line 24

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



21
22
23
# File 'lib/rbi/type.rb', line 21

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



30
31
32
# File 'lib/rbi/type.rb', line 30

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

#to_rbiObject



35
36
37
# File 'lib/rbi/type.rb', line 35

def to_rbi
  @name
end