Class: SorbetRails::ModelColumnUtils::ColumnType

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/sorbet-rails/model_column_utils.rb

Instance Method Summary collapse

Instance Method Details

#to_sObject



16
17
18
19
20
21
22
# File 'lib/sorbet-rails/model_column_utils.rb', line 16

def to_s
  type = base_type.to_s
  # A nullable array column should be T.nilable(T::Array[column_type]) not T::Array[T.nilable(column_type)]
  type = "T::Array[#{type}]" if array_type
  type = "T.nilable(#{type})" if nilable && type != "T.untyped"
  type
end