Class: RBI::Type::Composite Abstract

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

Constructor Details

#initialize(types) ⇒ Composite

: (Array types) -> void



407
408
409
410
# File 'lib/rbi/type.rb', line 407

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

Instance Attribute Details

#typesObject (readonly)

: Array



404
405
406
# File 'lib/rbi/type.rb', line 404

def types
  @types
end

Instance Method Details

#==(other) ⇒ Object

: (BasicObject other) -> bool



414
415
416
# File 'lib/rbi/type.rb', line 414

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