Class: Parlour::Types::Type

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/parlour/types.rb

Overview

The top-level, abstract class for a generalised type. All of the other types inherit from this. Do not instantiate.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.to_type(type_like) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/parlour/types.rb', line 23

def self.to_type(type_like)
  if type_like.is_a?(String)
    Raw.new(type_like)
  else
    type_like
  end
end

Instance Method Details

#describeObject



41
# File 'lib/parlour/types.rb', line 41

def describe; end

#generate_rbiObject



17
# File 'lib/parlour/types.rb', line 17

def generate_rbi; end

#generate_rbsObject



20
# File 'lib/parlour/types.rb', line 20

def generate_rbs; end

#hashObject



36
37
38
# File 'lib/parlour/types.rb', line 36

def hash
  [self.class, *instance_variables.map { |x| instance_variable_get(x).hash }].hash
end

#to_type(type_like) ⇒ Object



32
33
34
# File 'lib/parlour/types.rb', line 32

def to_type(type_like)
  Type.to_type(type_like)
end