Sha256: 933f95e6a3bae68dced90f517910196a5900574dbfad2bc20ad70c819b2220e1

Contents?: true

Size: 511 Bytes

Versions: 33

Compression:

Stored size: 511 Bytes

Contents

# typed: ignore
require 'sorbet-runtime'

if !$PROGRAM_NAME.include?('sorbet')
  module TypeAssertImpl
    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
  end

  class TA
    include TypeAssertImpl
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
sorbet-rails-0.7.34 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.33 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.32 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.31 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.27 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.26 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.25 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.24 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.23 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.22 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.20 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.19 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.18 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.5 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.4 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.3 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.2 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.1 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.7.0 lib/sorbet-rails/type_assert/type_assert_impl.rb
sorbet-rails-0.6.5.1 lib/sorbet-rails/type_assert/type_assert_impl.rb