Module: SorbetExtension

Defined in:
lib/easy_talk/sorbet_extension.rb

Overview

This module provides additional functionality for working with Sorbet types.

Instance Method Summary collapse

Instance Method Details

#nilable?Boolean

Checks if the types in the collection include the NilClass type.

Returns:

  • (Boolean)

    true if the types include NilClass, false otherwise.



8
9
10
11
12
# File 'lib/easy_talk/sorbet_extension.rb', line 8

def nilable?
  types.any? do |type|
    type.respond_to?(:raw_type) && type.raw_type == NilClass
  end
end