Class: RBI::Type::Simple

Inherits:
Type
  • Object
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

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