Class: RBI::Type::Composite

Inherits:
RBI::Type show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/rbi/type.rb

Overview

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

Constructor Details

#initialize(types) ⇒ Composite

Returns a new instance of Composite.



240
241
242
243
# File 'lib/rbi/type.rb', line 240

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

Instance Attribute Details

#typesObject (readonly)

Returns the value of attribute types.



237
238
239
# File 'lib/rbi/type.rb', line 237

def types
  @types
end

Instance Method Details

#==(other) ⇒ Object



246
247
248
# File 'lib/rbi/type.rb', line 246

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