module TypeAssertImpl

Make this type visible even when the concrete implementation cannot be loaded.

Public Class Methods

included(klass) click to toggle source
# File lib/sorbet-rails/type_assert/type_assert_impl.rb, line 6
def self.included(klass)
  klass.define_singleton_method(:[]) do |type|
    return Class.new do
      include ITypeAssert

      define_method(:to_s) { "TA[#{type.to_s}]" }

      define_method(:assert) do |val|
        T.let(val, type)
      end

      define_method(:get_type) { type }
    end
  end
end