Class: RBI::Type::Composite Abstract

Inherits:
RBI::Type show all
Defined in:
lib/rbi/type.rb

Overview

This class is abstract.

A type that is composed of multiple types like ‘T.all(String, Integer)`.

Direct Known Subclasses

All, Any

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, #normalize, parse_node, parse_string, proc, #rbs_string, self_type, shape, simple, #simplify, t_class, #to_rbi, #to_s, tuple, type_alias, type_parameter, untyped, void

Constructor Details

#initialize(types) ⇒ Composite

: (Array types) -> void



371
372
373
374
# File 'lib/rbi/type.rb', line 371

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

Instance Attribute Details

#typesObject (readonly)

: Array



368
369
370
# File 'lib/rbi/type.rb', line 368

def types
  @types
end

Instance Method Details

#==(other) ⇒ Object

: (BasicObject other) -> bool



378
379
380
# File 'lib/rbi/type.rb', line 378

def ==(other)
  self.class === other && @types.sort_by(&:to_rbi) == other.types.sort_by(&:to_rbi)
end