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



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

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

Instance Attribute Details

#nameObject (readonly)

: String



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

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object

: (BasicObject other) -> bool



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

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

#to_rbiObject

: -> String



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

def to_rbi
  @name
end