Class: RBI::Type::Simple

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

: (String name) -> void



18
19
20
21
# File 'lib/rbi/type.rb', line 18

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

Instance Attribute Details

#nameObject (readonly)

: String



15
16
17
# File 'lib/rbi/type.rb', line 15

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object

: (BasicObject other) -> bool



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

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

#normalizeObject

: -> Type



37
38
39
# File 'lib/rbi/type.rb', line 37

def normalize
  self
end

#simplifyObject

: -> Type



43
44
45
# File 'lib/rbi/type.rb', line 43

def simplify
  self
end

#to_rbiObject

: -> String



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

def to_rbi
  @name
end